Hi
Here the left is XML and right one is it’s DTD to validate the left side XML.
XML | DTD |
<xml version="1.0"?> <po id="PO1456"> <date year="2002" month="6" day="14" /> <address type="shipping"> <name>Frits Mendels</name> <street> <city> <state>CA</state> <zip>94045</zip> </address> <address type="billing"> <name>Frits Mendels</name> <street> <city> <state>CA</state> <zip>94123-6798</zip> </address> <items> <item quantity="1" productCode="R-273" description="14.4 Volt Cordless Drill" unitCost="189.95" /> <item quantity="1" productCode="1632S" description="12 Piece Drill Bit Set" unitCost="14.95" /> </items> </po> | <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT po (date,address+,items)> <!ATTLIST po id CDATA #REQUIRED> <!ELEMENT date EMPTY> <!ATTLIST date year CDATA #REQUIRED month (1|2|3|4|5|6|7|8|9|10|11|12) #REQUIRED day (1|2|3|4|5|6|7|8|9|10|11| 12|13|14|15|16|17|18|19| 20|21|22|23|24|25|26|27| 28|29|30|31) #REQUIRED> <!ELEMENT address (name,company?,street+,city,state,zip)> <!ATTLIST address type (billing|shipping) #REQUIRED> <!ELEMENT name (#PCDATA)> <!ELEMENT company (#PCDATA)> <! <!ELEMENT city (#PCDATA)> <!ELEMENT state (#PCDATA)> <!ELEMENT zip (#PCDATA)> <!ELEMENT items (item)+> <!ELEMENT item EMPTY> <!ATTLIST item quantity CDATA #REQUIRED productCode CDATA #REQUIRED description CDATA #REQUIRED unitCost CDATA #REQUIRED> |
Thanks & Regards,
Arun Manglick || Senior Tech Lead
No comments:
Post a Comment