validate XML against XSD

maverick70

New Member
I am trying to learn XSD and want to ask if there is another way to validate XML against XSD.It works the way I did it but want to know is anything wrong in my code. I have used an online site to validate XML against XSD. catalog.xml\[code\]<?xml version="1.0" encoding="ISO-8859-1"?><catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="catalog.xsd"> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1982</year> </cd> <cd> <title>Greatest Hits</title> <artist>Dolly Parton</artist> <country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd></catalog>\[/code\]catalog.xsd\[code\]<?xml version="1.0" encoding="ISO-8859-1"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="catalog"> <xs:complexType> <xs:sequence> <xs:choice maxOccurs="unbounded"> <xs:element name="cd"> <xs:complexType> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="artist" type="xs:string"/> <xs:element name="country" type="xs:string"/> <xs:element name="company" type="xs:string"/> <xs:element name="price" type="xs:decimal"/> <xs:element name="year" type="xs:integer"/> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:sequence> </xs:complexType> </xs:element></xs:schema>\[/code\]
 
Back
Top