1,105,290 Community Members

XML schema namespace validation concerns

Member Avatar
Junior Poster in Training
52 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]

Im working on applying a schema to an xml document but my editor (exchanger xml) is giving me some errors I can't figure out

Ln 35 Col 67 - s4s-elt-invalid-content.1: The content of '#AnonType_inventory' is invalid. Element 'element' is invalid, misplaced, or occurs too often.

Ln 16 Col 58 - cvc-elt.1: Cannot find the declaration of element 'xsd:schema'.

I've declared my xsd schema in the xsd file and the other error seems like it might be typo but T do not see one.

Here is my music.xsd schema document
<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:simpleType name="albumIDType">
        <xsd:restriction base="xsd:ID">
            <xsd:pattern value="JWd{6}" />  

    <xsd:simpleType name="jazzType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="New Orleans" />
            <xsd:enumeration value="Swing" />
            <xsd:enumeration value="Bebop" />
            <xsd:enumeration value="Modern" />                      
    <xsd:element name="inventory">
            <xsd:element name="album" minOccurs="1" maxOccurs="unbounded" >
                    <xsd:element name="title" type="xsd:string"/>
                    <xsd:element name="artist" type="xsd:string" minOccurs="1"/>
                    <xsd:element name="tracks">
                            <xsd:element name="track" minOccurs="1">
                                        <xsd:extension base="xsd:string">
                                            <xsd:attribute name="length" type="xsd:time" use="optional" />  
                            <xsd:attribute name="length" type="xsd:time" use="optional" />  
                    <xsd:attribute name="category" type="jazzType" use="required" />
                    <xsd:attribute name="albumID" type="albumIDType" use="required" />


And here is the XML doc

<?xml version="1.0" encoding="UTF-8"?>

<inventory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:noNameSpaceSchemaLocation="music.xsd" >
   <album category="Modern Jazz" albumID="JW001305">
      <title>Kind of Blue</title>
      <artist>Miles Davis</artist>
      <artist>John Coltrane</artist>
      <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>
   <album category="Bebop" albumID="JW001312">
      <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>
   <album category="Modern" albumID="JW-015011">
      <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>
   <album category="Modern" albumID="JW002210">
      <title>Sarah Vaughan</title>
      <artist>Sarah Vaughan</artist>
      <artist>Clifford Brown</artist>
      <tracks length="45:30">
         <track length="0:3:58">Lullaby of Birdland</track>
         <track length="0:6:18">April in Paris</track>
         <track length="0:4:10">He's My Guy</track>
         <track length="0:5:49">Jim</track>
         <track length="0:4:41">You're not the Kind</track>
         <track length="0:4:48">Embraceable You</track>
         <track length="0:5:08">I'm Glad there is You</track>
         <track length="0:5:43">September Song</track>
         <track length="0:4:55">It's Crazy</track>
   <album category="Swing" albumID="JW014501">
      <title>Ellington at Newport</title>
      <artist>Duke Ellington</artist>
      <tracks length="1:25:50">
         <track length="0:1:10">The Star Spangled Banner</track>
         <track length="0:3:36">Introduction</track>
         <track length="0:6:21">Black and Tan Fantasy</track>
         <track length="0:3:34">Tea for Two</track>
         <track length="0:4:27">Take the A Train</track>
         <track length="0:8:10">Festival Junction</track>
         <track length="0:7:09">Blues to be There</track>
         <track length="0:5:33">Newport Up</track>
         <track length="0:3:52">Sophisticated Lady</track>
         <track length="0:3:50">Day In, Day Out</track>
         <track length="0:14:20">Dimuendo in Blue/Crescendo in Blue</track>
         <track length="0:0:44">Annoucements, Pandemonium</track>
         <track length="0:3:38">I Got it Bad (and That Ain't Good)</track>
         <track length="0:4:46">Jeep's Blues</track>
         <track length="0:2:49">Tulip or Turnip</track>
         <track length="0:1:08">Riot Prevention</track>
         <track length="0:9:13">Skin Deep</track>
         <track length="0:1:30">Mood Indigo</track>
   <album category="Modern" albumID="JW024181">
      <title>Saxophone Colossus</title>
      <artist>Sonny Rollins</artist>
      <tracks length="0:39:51">
         <track length="0:6:46">St. Thomas</track>
         <track length="0:6:28">You Don't Know What Love Is</track>
         <track length="0:5:13">Strode Rode</track>
         <track length="0:10:06">Moritat</track>
         <track length="0:11:18">Blue 7</track>
   <album category="Bebop" albumID="JW031031">
      <title>The Cole Porter Songbook</title>
      <artist>Charlie Parker</artist>
      <artist>Cole Porter</artist>      
      <tracks length="0:38:56">
         <track length="0:3:24">Easy to Love</track>
         <track length="0:3:10">Begin the Beguine</track>
         <track length="0:2:45">Night and Day</track>
         <track length="0:2:38">What is This Thing Called Love</track>
         <track length="0:3:18">In the Still of the Night</track>
         <track length="0:3:31">I Get a Kick Out of You</track>
         <track length="0:2:39">Just One of Those Things</track>
         <track length="0:3:17">My Heart Belongs to Daddy</track>
         <track length="0:3:31">I've Got You Under My Skin</track>
         <track length="0:5:33">Love for Sale</track>
         <track length="0:5:10">I Love Paris</track>
   <album category="Modern" albumID="JW061051">
      <title>The Sound of Jazz</title>
      <artist>Billie Holiday</artist>
      <artist>Count Basie</artist>
      <artist>Red Allen</artist>
      <artist>Lester Young</artist>
      <artist>Coleman Hawkins</artist>  
      <tracks length="0:41:41">
         <track length="0:4:46">Wild Man Blues</track>
         <track length="0:4:57">Rosetta</track>
         <track length="0:6:19">Fine and Mellow</track>
         <track length="0:6:53">Blues</track>
         <track length="0:4:27">I Left my Baby</track>
         <track length="0:4:43">The Train and the River</track>
         <track length="0:3:43">Nervous</track>
         <track length="0:5:53">Dickie's Dream</track>

There were some typos of which I've found and fixed, and the code is "well formed". Am I declaring the attached schema wrong in the xml document?

This article has been dead for over three months: Start a new discussion instead
Start New Discussion
View similar articles that have also been tagged: