BoulderNative
IS-IT--Management
Hi,
I am new to XML and am struggling to understand some elemental concepts relating to XML. I am working to learn namespaces and how to nest simpleTypes and complexTypes in a Russian Doll format. I have been researching the internet and several books I have in my possession to see if I can find the answers, and I just seem to be getting more confused/going in circles. I am wondering if someone could offer some assistance.
This is my xml file:
<?xml version="1.0" encoding="UTF-8"?>
<inventory xsi:noNamespaceSchemaLocation="music.xsd"
xmlns:xsi="
<album category="Modern" albumID="JW001305">
<title>Kind of Blue</title>
<artist>Miles Davis</artist>
<artist>John Coltrane</artist>z
<tracks length="0:45:44">
<track length="0:9:22">So What</track>
<track length="0:9:46">Freddie Freeloader</track>
<track length="0:5:37">Blue in Green</track>
<track length="0:11:33">All Blues</track>
<track length="0:9:26">Flamenco Sketches</track>
</tracks>
</album>
<album category="Bebop" albumID="JW001312">
<title>Cookin'</title>
<artist>Miles Davis</artist>
<tracks length="0:35:13">
<track length="0:5:57">My Funny Valentine</track>
<track length="0:9:53">Blues by Five</track>
<track length="0:4:22">Airegin</track>
<track length="0:13:03">Tune-Up</track>
</tracks>
</album>
<album category="Modern" albumID="JW015011">
<title>Blue Train</title>
<artist>John Coltrane</artist>
<tracks length="0:41:54">
<track length="0:10:39">Blue Train</track>
<track length="0:9:06">Moment's Notice</track>
<track length="0:7:11">Locomotion</track>
<track length="0:7:55">I'm Old Fashioned</track>
<track length="0:7:03">Lazy Bird</track>
</tracks>
</album>
</inventory>
***EOF***
This is my .xsd file:
<?xml version="1.0" encoding="UTF-8"?>
<xsi:schema xmlns:xsi="
<xsi:simpleType name="albumIDType" >
<xsi:restriction base="xsi:ID" >
<xsiattern value="JW######" />
</xsi:restriction>
</xsi:simpleType>
<xsi:simpleType name="jazzType" >
<xsi:restriction base="xsi:string" >
<xsi:enumeration value="New_Orleans" />
<xsi:enumeration value="Swing" />
<xsi:enumeration value="Bebop" />
<xsi:enumeration value="Modern" />
</xsi:restriction>
</xsi:simpleType>
<xsi:element name="inventory" >
<xsi:complexType>
<xsi:element name="album" minOccurs="1" maxOccurs="unbounded" />
<xsi:complexType>
<xsi:sequence>
<xsi:element name="title" type="xsi:string" />
<xsi:element name="artist" type="xsi:string" minOccurs="1" maxOccurs="unbounded" />
<xsi:element name="tracks" />
<xsi:complextype>
<xsi:simpleContent>
<xsi:extension base="xsi:time">
<xsi:attribute name="length" type="xsi:time" />
<xsi:complexType>
<xsi:element name="track" type="xsi:string" minOccurs="1" maxOccurs="unbounded"/> <xsi:complextype>
<xsi:simpleContent>
<xsi:extension base="xsi:time">
<xsi:attribute name="length" type="xsi:time" />
</xsi:extension>
</xsi:simpleContent>
</xsi:complextype>
</xsi:complexType>
</xsi:extension>
</xsi:simpleContent>
</xsi:complextype>
<xsi:attribute name="category" type="jazzType" />
<xsi:attribute name="albumID" type="albumIDType" />
</xsi:sequence>
</xsi:complexType>
</xsi:complexType>
</xsi:element>
</xsi:schema>
***EOF***
The XML file will not validate. Here is the error message I am getting:
[Xerces-J 2.9.1] Validating "jw.xml" against "file:/C:/Documents and Settings/Phil/My Documents/Education/MCT_617/Week 5 Homework/c4_case_1/music.xsd" ...
Ln 35 Col 70 - s4s-elt-invalid-content.1: The content of '#AnonType_inventory' is invalid. Element 'element' is invalid, misplaced, or occurs too often.
1 Errors
Any pointers or tips in helping me understand what I am doing wrong here would be appreciated...
I am new to XML and am struggling to understand some elemental concepts relating to XML. I am working to learn namespaces and how to nest simpleTypes and complexTypes in a Russian Doll format. I have been researching the internet and several books I have in my possession to see if I can find the answers, and I just seem to be getting more confused/going in circles. I am wondering if someone could offer some assistance.
This is my xml file:
<?xml version="1.0" encoding="UTF-8"?>
<inventory xsi:noNamespaceSchemaLocation="music.xsd"
xmlns:xsi="
<album category="Modern" albumID="JW001305">
<title>Kind of Blue</title>
<artist>Miles Davis</artist>
<artist>John Coltrane</artist>z
<tracks length="0:45:44">
<track length="0:9:22">So What</track>
<track length="0:9:46">Freddie Freeloader</track>
<track length="0:5:37">Blue in Green</track>
<track length="0:11:33">All Blues</track>
<track length="0:9:26">Flamenco Sketches</track>
</tracks>
</album>
<album category="Bebop" albumID="JW001312">
<title>Cookin'</title>
<artist>Miles Davis</artist>
<tracks length="0:35:13">
<track length="0:5:57">My Funny Valentine</track>
<track length="0:9:53">Blues by Five</track>
<track length="0:4:22">Airegin</track>
<track length="0:13:03">Tune-Up</track>
</tracks>
</album>
<album category="Modern" albumID="JW015011">
<title>Blue Train</title>
<artist>John Coltrane</artist>
<tracks length="0:41:54">
<track length="0:10:39">Blue Train</track>
<track length="0:9:06">Moment's Notice</track>
<track length="0:7:11">Locomotion</track>
<track length="0:7:55">I'm Old Fashioned</track>
<track length="0:7:03">Lazy Bird</track>
</tracks>
</album>
</inventory>
***EOF***
This is my .xsd file:
<?xml version="1.0" encoding="UTF-8"?>
<xsi:schema xmlns:xsi="
<xsi:simpleType name="albumIDType" >
<xsi:restriction base="xsi:ID" >
<xsiattern value="JW######" />
</xsi:restriction>
</xsi:simpleType>
<xsi:simpleType name="jazzType" >
<xsi:restriction base="xsi:string" >
<xsi:enumeration value="New_Orleans" />
<xsi:enumeration value="Swing" />
<xsi:enumeration value="Bebop" />
<xsi:enumeration value="Modern" />
</xsi:restriction>
</xsi:simpleType>
<xsi:element name="inventory" >
<xsi:complexType>
<xsi:element name="album" minOccurs="1" maxOccurs="unbounded" />
<xsi:complexType>
<xsi:sequence>
<xsi:element name="title" type="xsi:string" />
<xsi:element name="artist" type="xsi:string" minOccurs="1" maxOccurs="unbounded" />
<xsi:element name="tracks" />
<xsi:complextype>
<xsi:simpleContent>
<xsi:extension base="xsi:time">
<xsi:attribute name="length" type="xsi:time" />
<xsi:complexType>
<xsi:element name="track" type="xsi:string" minOccurs="1" maxOccurs="unbounded"/> <xsi:complextype>
<xsi:simpleContent>
<xsi:extension base="xsi:time">
<xsi:attribute name="length" type="xsi:time" />
</xsi:extension>
</xsi:simpleContent>
</xsi:complextype>
</xsi:complexType>
</xsi:extension>
</xsi:simpleContent>
</xsi:complextype>
<xsi:attribute name="category" type="jazzType" />
<xsi:attribute name="albumID" type="albumIDType" />
</xsi:sequence>
</xsi:complexType>
</xsi:complexType>
</xsi:element>
</xsi:schema>
***EOF***
The XML file will not validate. Here is the error message I am getting:
[Xerces-J 2.9.1] Validating "jw.xml" against "file:/C:/Documents and Settings/Phil/My Documents/Education/MCT_617/Week 5 Homework/c4_case_1/music.xsd" ...
Ln 35 Col 70 - s4s-elt-invalid-content.1: The content of '#AnonType_inventory' is invalid. Element 'element' is invalid, misplaced, or occurs too often.
1 Errors
Any pointers or tips in helping me understand what I am doing wrong here would be appreciated...