Hey everyone,
For the past few days I've been trying to produce an XSD schema that will validate my simple products XML. At first I tried it with the full XML and ran into several issues, so I tried to take things back a step.
For this very simple XML:
Code:
<?xml version="1.0"?>
<products>
<product>
<title>Product A</title>
</product>
</products>
I have this schema:
Code:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="products">
<xs:sequence>
<xs:element name="product">
<xs:sequence>
<xs:complexType>
<xs:element name="title" type="xs:string" />
</xs:complexType>
</xs:sequence>
</xs:element>
</xs:sequence>
</xs:element>
</xs:schema>
However when I try and validate this using an online tool (tried several), I get back this error message:
4s-elt-must-match.1: The content of 'products' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: sequence.
I feel like I'm missing something really fundamental here, but just can't figure out what?
Edit
I also tried the following schema:
Code:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="products">
<xs:complexType>
<xs:sequence>
<xs:element name="product">
<xs:sequence>
<xs:complexType>
<xs:element name="title" type="xs:string" />
</xs:complexType>
</xs:sequence>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Neither work.
Any help would be extremely appreciated!
Thanks
Adam