[jdom-interest] Validation

Clas Forsberg clas.forsberg at omgroup.com
Fri Nov 24 03:33:50 PST 2000


Whats wrong with this schema or xml-file?
I got this message when I try to validate it with jdom.

element song must be declared



<?xml version="1.0" encoding="ISO-8859-1"?>
<SONG xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="nested_song.xsd">
  <TITLE>Hot Cop</TITLE>
  <PHOTO ALT="Victor Willis in Cop Outfit" WIDTH="100" HEIGHT="200"/>
  <COMPOSER>
    <NAME>
      <GIVEN>Jacques</GIVEN>
      <FAMILY>Morali</FAMILY>
    </NAME>
  </COMPOSER>
  <COMPOSER>
    <NAME>
      <GIVEN>Henri</GIVEN>
      <FAMILY>Belolo</FAMILY>
    </NAME>
  </COMPOSER>
  <COMPOSER>
    <NAME>
      <GIVEN>Victor</GIVEN>
      <FAMILY>Willis</FAMILY>
    </NAME>
  </COMPOSER>
  <PRODUCER>
    <NAME>
      <GIVEN>Jacques</GIVEN>
      <FAMILY>Morali</FAMILY>
    </NAME>
  </PRODUCER>
  <PUBLISHER>PolyGram Records</PUBLISHER>
  <YEAR>1978</YEAR>
  <ARTIST>Village People</ARTIST>
</SONG>

/*********************************************************************************************************************************************************/

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
  <xsd:element name="SONG" type="SongType"/>
  <xsd:complexType name="ComposerType">
    <xsd:element name="NAME">
      <xsd:complexType>
        <xsd:element name="GIVEN" type="xsd:string" minOccurs="1" maxOccurs="1
"/>
        <xsd:element name="FAMILY" type="xsd:string" minOccurs="1" maxOccurs="1
"/>
      </xsd:complexType>
    </xsd:element>
  </xsd:complexType>
  <xsd:complexType name="ProducerType">
    <xsd:element name="NAME">
      <xsd:complexType>
        <xsd:element name="GIVEN" type="xsd:string" minOccurs="1" maxOccurs="1
"/>
        <xsd:element name="FAMILY" type="xsd:string" minOccurs="1" maxOccurs="1
"/>
      </xsd:complexType>
    </xsd:element>
  </xsd:complexType>
  <xsd:complexType name="PhotoType">
    <xsd:complexContent>
      <xsd:restriction base="xsd:anyType">
        <xsd:attribute name="ALT" type="xsd:string"/>
        <xsd:attribute name="WIDTH" type="xsd:nonNegativeInteger"/>
        <xsd:attribute name="HEIGHT" type="xsd:nonNegativeInteger"/>
      </xsd:restriction>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:complexType name="SongType">
    <xsd:element name="TITLE" type="xsd:string" minOccurs="1" maxOccurs="1"/>
    <xsd:element name="PHOTO" type="PhotoType" minOccurs="0" maxOccurs="1"/>
    <xsd:element name="COMPOSER" type="ComposerType" minOccurs="1" maxOccurs="
unbounded"/>
    <xsd:element name="PRODUCER" type="ProducerType" minOccurs="0" maxOccurs="
unbounded"/>
    <xsd:element name="PUBLISHER" type="xsd:string" minOccurs="0" maxOccurs="1
"/>
    <xsd:element name="YEAR" type="xsd:year" minOccurs="1" maxOccurs="1"/>
    <xsd:element name="ARTIST" type="xsd:string" minOccurs="1" maxOccurs="
unbounded"/>
  </xsd:complexType>
</xsd:schema>

/**********************************************************************************************************************************************/






More information about the jdom-interest mailing list