icedz
Technical User
- Jan 6, 2009
- 1
Hi all, I am new to XML and decided to try and self teach myself XML by following a few online help stuff. I am trying to create an xml schema and instance document, but I am not sure on how successful I have been because of my low experiance with XML.
Does anyone whether my schema and instance document are working correctly together?
Any help will be much appreciated.
Thanks, Rick.
XML Schema
<xsd:schema xmlns:xsd="
<xsd:element name="CarDocument" type="CarDocument"/>
<xsd:complexType name="CarDocument">
<xsd:sequence>
<xsd:element name="Car" type="Car"/>
<xsd:element name="LeaseDate" type="LeaseDate"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Car">
<xsd:sequence>
<xsd:element name="RegistrationNumberr" type="xsd:decimal"/>
<xsd:element name="LocationInformation" type="xsd:string"/>
<xsd:element name="TypeOfCar" type="xsd:string"/>
<xsd:element name="DescriptionTextOfCar" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="LeaseDate">
<xsd:sequence>
<xsd:element name="StartDate" type="xsd:date"/>
<xsd:element name="EndDate" type="xsd:date"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
XML Instance Document
<?xml version="1.0"?>
<xml:InstanceDocument xmlns:xsd="
<CarInfo
xsi:noNamespaceSchemaLocation="XMLCarDocument.xsd"
xmlns:cat="CarInfo.xml">
<xi:include href="CarInfo.xml"/>
<MonumentInfo schemaLocation="XMLCarDocument.xsd">
<Car>
<RegistrationNumberr>19285</RegistrationNumberr>
<LocationInformation>NEWYOK</LocationInformation>
<TypeOfCar>SPORTCAR</TypeOfCar>
<DescriptionTextOfCar>It is a sports car and is superfast!</DescriptionTextOfCar>
</Car>
<LeaseDate>
<StartDate>10/12/2008</StartDate>
<EndDate>5/06/2009</EndDate>
</LeaseDate>
</CarInfo>
Does anyone whether my schema and instance document are working correctly together?
Any help will be much appreciated.
Thanks, Rick.
XML Schema
<xsd:schema xmlns:xsd="
<xsd:element name="CarDocument" type="CarDocument"/>
<xsd:complexType name="CarDocument">
<xsd:sequence>
<xsd:element name="Car" type="Car"/>
<xsd:element name="LeaseDate" type="LeaseDate"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Car">
<xsd:sequence>
<xsd:element name="RegistrationNumberr" type="xsd:decimal"/>
<xsd:element name="LocationInformation" type="xsd:string"/>
<xsd:element name="TypeOfCar" type="xsd:string"/>
<xsd:element name="DescriptionTextOfCar" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="LeaseDate">
<xsd:sequence>
<xsd:element name="StartDate" type="xsd:date"/>
<xsd:element name="EndDate" type="xsd:date"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
XML Instance Document
<?xml version="1.0"?>
<xml:InstanceDocument xmlns:xsd="
<CarInfo
xsi:noNamespaceSchemaLocation="XMLCarDocument.xsd"
xmlns:cat="CarInfo.xml">
<xi:include href="CarInfo.xml"/>
<MonumentInfo schemaLocation="XMLCarDocument.xsd">
<Car>
<RegistrationNumberr>19285</RegistrationNumberr>
<LocationInformation>NEWYOK</LocationInformation>
<TypeOfCar>SPORTCAR</TypeOfCar>
<DescriptionTextOfCar>It is a sports car and is superfast!</DescriptionTextOfCar>
</Car>
<LeaseDate>
<StartDate>10/12/2008</StartDate>
<EndDate>5/06/2009</EndDate>
</LeaseDate>
</CarInfo>