I am building an XML Schema for the first time, and I am diving in head first. What I have does not seem to work, and was wondering if anyone could give me any advice on making it better formed.
What it is is an image (TileSet) described by a Name Attribute and a FilePath attribute. The image can be broken down into two kinds of separate sections as defined by its Animation and Inanimate elements. Each Tileset can have any number of Animations and Inanimates.
This is what I have:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="tileSetContents"
targetNamespace=" elementFormDefault="qualified"
xmlns=" xmlns:mstns=" xmlns:xs=">
<xs:element name="TileSet">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="Animation">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element type="xs:string" nillable="false" name="Name" />
<xs:element type="xs:integer" nillable="false" name="X" />
<xs:element type="xs:integer" nillable="false" name="Y" />
<xs:element type="xs:integer" nillable="false" name="Width" />
<xs:element type="xs:integer" nillable="false" name="Height" />
<xs:element type="xs:integer" nillable="false" name="NumberOfTiles" />
<xs:element type="xs:integer" nillable="false" name="DurationOfAnimationMS" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Inanimate">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element type="xs:string" nillable="false" name="Name" />
<xs:element type="xs:integer" nillable="false" name="X" />
<xs:element type="xs:integer" nillable="false" name="Y" />
<xs:element type="xs:integer" nillable="false" name="Width" />
<xs:element type="xs:integer" nillable="false" name="Height" />
</xs:sequence>
</xs:complexType>
</xs:element >
</xs:sequence>
<xs:attribute name="Name" use="required" />
<xs:attribute name="ImagePath" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>
And I am pointing to it from an XML fie as such:
<TileSet xmlns="D:\Programming\animationClassLibrary\animationClassLibrary"
xmlns:xsi="xsi:schemaLocation="D:\Programming\animationClassLibrary\animationClassLibrary tileSetContents.xsd">
</TileSet>
Any ideas what is going wrong here?
What it is is an image (TileSet) described by a Name Attribute and a FilePath attribute. The image can be broken down into two kinds of separate sections as defined by its Animation and Inanimate elements. Each Tileset can have any number of Animations and Inanimates.
This is what I have:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="tileSetContents"
targetNamespace=" elementFormDefault="qualified"
xmlns=" xmlns:mstns=" xmlns:xs=">
<xs:element name="TileSet">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="Animation">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element type="xs:string" nillable="false" name="Name" />
<xs:element type="xs:integer" nillable="false" name="X" />
<xs:element type="xs:integer" nillable="false" name="Y" />
<xs:element type="xs:integer" nillable="false" name="Width" />
<xs:element type="xs:integer" nillable="false" name="Height" />
<xs:element type="xs:integer" nillable="false" name="NumberOfTiles" />
<xs:element type="xs:integer" nillable="false" name="DurationOfAnimationMS" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Inanimate">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element type="xs:string" nillable="false" name="Name" />
<xs:element type="xs:integer" nillable="false" name="X" />
<xs:element type="xs:integer" nillable="false" name="Y" />
<xs:element type="xs:integer" nillable="false" name="Width" />
<xs:element type="xs:integer" nillable="false" name="Height" />
</xs:sequence>
</xs:complexType>
</xs:element >
</xs:sequence>
<xs:attribute name="Name" use="required" />
<xs:attribute name="ImagePath" use="required" />
</xs:complexType>
</xs:element>
</xs:schema>
And I am pointing to it from an XML fie as such:
<TileSet xmlns="D:\Programming\animationClassLibrary\animationClassLibrary"
xmlns:xsi="xsi:schemaLocation="D:\Programming\animationClassLibrary\animationClassLibrary tileSetContents.xsd">
</TileSet>
Any ideas what is going wrong here?