Advertisement
olekturbo

Untitled

Jun 10th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. //XML
  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <sklep>
  4. <dzial id="1234">
  5. <rodzaj>spożywczy</rodzaj>
  6. <towar cena="3.00" ilosc="30">cukier</towar>
  7. <towar cena="1.50" ilosc="10">jogurt</towar>
  8. <towar cena="0.60" ilosc="10">pieczywo</towar>
  9. <towar cena="5.60" ilosc="10">kawa</towar>
  10. </dzial>
  11. <dzial id="1235">
  12. <rodzaj>chemiczny</rodzaj>
  13. <towar cena="3.00" ilosc="30">proszek do prania</towar>
  14. <towar cena="3.50" ilosc="10">pasta do zebow</towar>
  15. <towar cena="2.00" ilosc="10">wybielacz</towar>
  16. </dzial>
  17. </sklep>
  18.  
  19. //XSD
  20. <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  21. <xs:element name="sklep">
  22. <xs:complexType>
  23. <xs:sequence>
  24. <xs:element name="dzial" maxOccurs="unbounded" minOccurs="0">
  25. <xs:complexType>
  26. <xs:sequence>
  27. <xs:element name="rodzaj">
  28. <xs:simpleType>
  29. <xs:restriction base="xs:string">
  30. <xs:enumeration value="spożywczy"/>
  31. <xs:enumeration value="chemiczny"/>
  32. </xs:restriction>
  33. </xs:simpleType>
  34. </xs:element>
  35. <xs:element name="towar" maxOccurs="unbounded" minOccurs="0">
  36. <xs:complexType>
  37. <xs:simpleContent>
  38. <xs:extension base="xs:string">
  39. <xs:attribute name="cena" use="optional">
  40. <xs:simpleType>
  41. <xs:restriction base="xs:decimal">
  42. <xs:fractionDigits value="2"/>
  43. </xs:restriction>
  44. </xs:simpleType>
  45. </xs:attribute>
  46. <xs:attribute name="ilosc" use="optional">
  47. <xs:simpleType>
  48. <xs:restriction base="xs:float">
  49. <xs:minInclusive value="0"/>
  50. </xs:restriction>
  51. </xs:simpleType>
  52. </xs:attribute>
  53. </xs:extension>
  54. </xs:simpleContent>
  55. </xs:complexType>
  56. <xs:key name="ID">
  57. <xs:selector xpath="sklep/dzial" />
  58. <xs:field xpath="@id" />
  59. </xs:key>
  60. <xs:keyref name="IDREF" refer="ID">
  61. <xs:selector xpath="sklep/dzial" />
  62. <xs:field xpath="towar" />
  63. </xs:keyref>
  64. </xs:element>
  65. </xs:sequence>
  66. <xs:attribute type="xs:short" name="id" use="optional"/>
  67. </xs:complexType>
  68. </xs:element>
  69. </xs:sequence>
  70. </xs:complexType>
  71. </xs:element>
  72. </xs:schema>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement