M
Matthew
I am writing an XML schema to describe the format of entries in a
reference of Japanese grammar. I finished the Schema for the most
part, and it validates correctly as a Schema document.
However, I tried writing a sample XML document based on the Schema, but
every parser I run it through says that none of my tags have been
defined. I'm sure I'm missing something simple, but I'm stumped. I
have tired several methods of tieing the XML doc to the schema (none of
which really made much sense to me). What is the best way to do this?
Here are copies of the schema and the XML sample: (note, the sample
contains Japanese characters)
--- schema ---
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
XML Schema for Japanese Grammar Reference Entry
Revision 0.1a
</xsd:documentation>
</xsd:annotation>
<xsd:complexType name="reference">
<xsd:sequence>
<xsd:element name="referenceEntry" type="referenceEntryType"
minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="revision" type="xsd:string" use="required" />
<xsd:attribute name="abridged" type="xsd:boolean" use="required" />
</xsd:complexType>
<xsd:complexType name="referenceEntryType">
<xsd:sequence>
<xsd:element name="entry" type="entryType" maxOccurs="unbounded" />
<xsd:element name="definition" type="definitionType" maxOccurs="unbounded" />
<xsd:element name="usageNotes" type="usageNotesType" maxOccurs="unbounded" />
<xsd:element name="example" type="exampleType" maxOccurs="unbounded"
nillable="true" />
<xsd:element name="relatedForms" type="relatedFormsType"
maxOccurs="unbounded" nillable="true"/>
</xsd:sequence>
<xsd:attributeGroup ref="referenceAttributeGroup" />
</xsd:complexType>
<xsd:attributeGroup name="referenceAttributeGroup"
id="referenceAttributeGroup">
<xsd:attribute name="id" type="xsdositiveInteger" use="required" />
<xsd:attribute name="vulgar" type="xsd:boolean" use="optional"
default="false" />
<xsd:attribute name="colloquial" type="xsd:boolean" use="optional"
default="false" />
<xsd:attribute name="archaic" type="xsd:boolean" use="optional"
default="false" />
<xsd:attribute name="juvenile" type="xsd:boolean" use="optional"
default="false" />
</xsd:attributeGroup>
<xsd:complexType name="entryType" mixed="true">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="noun" type="nounType" />
<xsd:element name="verb" type="verbType" />
<xsd:element name="adjective" type="adjectiveType" />
<xsd:element name="adverb" type="adverbType" />
<xsd:element name="conjunction" type="conjunctionType" />
<xsd:element name="interjection" type="interjectionType" />
<xsd:element name="subsentence" type="subsentenceType" />
<xsd:element name="clause" type="clauseType" />
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="gender" type="genderType" use="optional"
default="neutral" />
</xsd:complexType>
<xsd:simpleType name="genderType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="male" />
<xsd:enumeration value="female" />
<xsd:enumeration value="neutral" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="nounType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="verbType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="verbConjugation" type="verbConjugationType"
use="required" />
<xsd:attribute name="verbQuality" type="verbQualityType"
use="optional" default="n/a" />
<xsd:attribute name="verbFormality" type="verbFormalityType"
use="optional" default="n/a" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="verbConjugationType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="non-past" />
<xsd:enumeration value="past" />
<xsd:enumeration value="te-form" />
<xsd:enumeration value="conditional" />
<xsd:enumeration value="provisional" />
<xsd:enumeration value="potential" />
<xsd:enumeration value="passive" />
<xsd:enumeration value="causative" />
<xsd:enumeration value="causative-passive" />
<xsd:enumeration value="volitional" />
<xsd:enumeration value="conjectural" />
<xsd:enumeration value="alternative" />
<xsd:enumeration value="imperative" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="verbQualityType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="affirmative" />
<xsd:enumeration value="negative" />
<xsd:enumeration value="n/a" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="verbFormalityType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="informal" />
<xsd:enumeration value="formal" />
<xsd:enumeration value="n/a" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="adjectiveType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="adjectiveGroup" type="adjectiveGroupType"
use="required" />
<xsd:attribute name="adjectiveConjugation"
type="adjectiveConjugationType" use="required" />
<xsd:attribute name="adjectiveQuality" type="adjectiveQualityType"
use="required" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="adjectiveGroupType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="i-adjective" />
<xsd:enumeration value="na-adjective" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="adjectiveConjugationType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="plain" />
<xsd:enumeration value="te-form" />
<xsd:enumeration value="adverbial" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="adjectiveQualityType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="affirmative" />
<xsd:enumeration value="negative" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="adverbType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="conjunctionType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="interjectionType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="subsentenceType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="clauseType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="definitionType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="language" type="xsd:language" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="usageNotesType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="language" type="xsd:language" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="exampleType">
<xsd:sequence>
<xsd:element name="japaneseSentence" type="japaneseSentenceType" />
<xsd:element name="translatedSentence" type="translationStringType"
maxOccurs="unbounded" nillable="true" />
<xsd:element name="source" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="trusted" type="xsd:boolean" use="optional"
default="false" />
</xsd:complexType>
<xsd:complexType name="japaneseSentenceType" mixed="true">
<xsd:sequence>
<xsd:element name="kanjiReading" type="xsd:string" minOccurs="0"
maxOccurs="unbounded" />
<xsd:element name="usage" type="xsd:string" maxOccurs="unbounded" />
<xsd:element name="kanjiReading" type="xsd:string" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="translationStringType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="language" type="xsd:language" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="relatedFormsType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="id" type="xsdositiveInteger" use="required" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
--- schema ---
--- sample ---
<?xml version="1.0" encoding="utf-8"?>
<reference revision="0.1a" abridged="true">
<referenceEntry id="0" vulgar="false" colloquial="false"
archaic="false" juvenile="false">
<entry gender="neutral">
<verb verbConjugation="te-form" verbQuality="n/a" verbFormality="n/a" />??
</entry>
<definition language="en-us">after</definition>
<usageNotes language="en-us">This form expresses the order of a
sequece of 2 actions.</usageNotes>
<example trusted="true">
<japaneseSentence>
<ruby><rb>??</rb><rt>???</rt>?<rb>?</rb><rt>???</rt>??<rb>???</rb><rt>?????</rt>????<usage>??</usage><rb>?</rb><rt>?</rt>????</ruby>
</japaneseSentence>
<translatedSentence
</japaneseSentence>
<translatedSentence language="en-us">
I came today after breakfast.
</translatedSentence>
<source>Unknown</source>
</example>
<example trusted="true">
<japaneseSentence>
<ruby>????<rb>?</rb><rt>??</rt>???????<rb>?</rb><rt>??</rt>?<rb>??</rb><rt>????</rt>????<usage>??</usage><rb>?</rb><rt>?</rt>????</ruby>
</japaneseSentence>
<translatedSentence
</japaneseSentence>
<translatedSentence language="en-us">
After I become a little more skillful, I will buy such a guitar.
</translatedSentence>
<source>Unknown</source>
</example>
<example trusted="false">
<japaneseSentence>
<ruby>????<rb>??</rb><rt>??</rt>?<rb>?</rb><rt>?</rt>??<usage>??</usage><rb>?</rb><rt>?</rt>????</ruby>
</japaneseSentence>
<translatedSentence
</japaneseSentence>
<translatedSentence language="en-us">
After Godzilla ate the city, he went to sleep!
</translatedSentence>
<source>Unknown</source>
</example>
<relatedForms id="" />
</referenceEntry>
</reference>
--- sample ---
reference of Japanese grammar. I finished the Schema for the most
part, and it validates correctly as a Schema document.
However, I tried writing a sample XML document based on the Schema, but
every parser I run it through says that none of my tags have been
defined. I'm sure I'm missing something simple, but I'm stumped. I
have tired several methods of tieing the XML doc to the schema (none of
which really made much sense to me). What is the best way to do this?
Here are copies of the schema and the XML sample: (note, the sample
contains Japanese characters)
--- schema ---
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation xml:lang="en">
XML Schema for Japanese Grammar Reference Entry
Revision 0.1a
</xsd:documentation>
</xsd:annotation>
<xsd:complexType name="reference">
<xsd:sequence>
<xsd:element name="referenceEntry" type="referenceEntryType"
minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="revision" type="xsd:string" use="required" />
<xsd:attribute name="abridged" type="xsd:boolean" use="required" />
</xsd:complexType>
<xsd:complexType name="referenceEntryType">
<xsd:sequence>
<xsd:element name="entry" type="entryType" maxOccurs="unbounded" />
<xsd:element name="definition" type="definitionType" maxOccurs="unbounded" />
<xsd:element name="usageNotes" type="usageNotesType" maxOccurs="unbounded" />
<xsd:element name="example" type="exampleType" maxOccurs="unbounded"
nillable="true" />
<xsd:element name="relatedForms" type="relatedFormsType"
maxOccurs="unbounded" nillable="true"/>
</xsd:sequence>
<xsd:attributeGroup ref="referenceAttributeGroup" />
</xsd:complexType>
<xsd:attributeGroup name="referenceAttributeGroup"
id="referenceAttributeGroup">
<xsd:attribute name="id" type="xsdositiveInteger" use="required" />
<xsd:attribute name="vulgar" type="xsd:boolean" use="optional"
default="false" />
<xsd:attribute name="colloquial" type="xsd:boolean" use="optional"
default="false" />
<xsd:attribute name="archaic" type="xsd:boolean" use="optional"
default="false" />
<xsd:attribute name="juvenile" type="xsd:boolean" use="optional"
default="false" />
</xsd:attributeGroup>
<xsd:complexType name="entryType" mixed="true">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="noun" type="nounType" />
<xsd:element name="verb" type="verbType" />
<xsd:element name="adjective" type="adjectiveType" />
<xsd:element name="adverb" type="adverbType" />
<xsd:element name="conjunction" type="conjunctionType" />
<xsd:element name="interjection" type="interjectionType" />
<xsd:element name="subsentence" type="subsentenceType" />
<xsd:element name="clause" type="clauseType" />
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="gender" type="genderType" use="optional"
default="neutral" />
</xsd:complexType>
<xsd:simpleType name="genderType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="male" />
<xsd:enumeration value="female" />
<xsd:enumeration value="neutral" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="nounType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="verbType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="verbConjugation" type="verbConjugationType"
use="required" />
<xsd:attribute name="verbQuality" type="verbQualityType"
use="optional" default="n/a" />
<xsd:attribute name="verbFormality" type="verbFormalityType"
use="optional" default="n/a" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="verbConjugationType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="non-past" />
<xsd:enumeration value="past" />
<xsd:enumeration value="te-form" />
<xsd:enumeration value="conditional" />
<xsd:enumeration value="provisional" />
<xsd:enumeration value="potential" />
<xsd:enumeration value="passive" />
<xsd:enumeration value="causative" />
<xsd:enumeration value="causative-passive" />
<xsd:enumeration value="volitional" />
<xsd:enumeration value="conjectural" />
<xsd:enumeration value="alternative" />
<xsd:enumeration value="imperative" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="verbQualityType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="affirmative" />
<xsd:enumeration value="negative" />
<xsd:enumeration value="n/a" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="verbFormalityType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="informal" />
<xsd:enumeration value="formal" />
<xsd:enumeration value="n/a" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="adjectiveType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="adjectiveGroup" type="adjectiveGroupType"
use="required" />
<xsd:attribute name="adjectiveConjugation"
type="adjectiveConjugationType" use="required" />
<xsd:attribute name="adjectiveQuality" type="adjectiveQualityType"
use="required" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="adjectiveGroupType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="i-adjective" />
<xsd:enumeration value="na-adjective" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="adjectiveConjugationType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="plain" />
<xsd:enumeration value="te-form" />
<xsd:enumeration value="adverbial" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="adjectiveQualityType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="affirmative" />
<xsd:enumeration value="negative" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="adverbType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="conjunctionType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="interjectionType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="subsentenceType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="clauseType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<!-- empty marker -->
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="definitionType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="language" type="xsd:language" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="usageNotesType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="language" type="xsd:language" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="exampleType">
<xsd:sequence>
<xsd:element name="japaneseSentence" type="japaneseSentenceType" />
<xsd:element name="translatedSentence" type="translationStringType"
maxOccurs="unbounded" nillable="true" />
<xsd:element name="source" type="xsd:string" />
</xsd:sequence>
<xsd:attribute name="trusted" type="xsd:boolean" use="optional"
default="false" />
</xsd:complexType>
<xsd:complexType name="japaneseSentenceType" mixed="true">
<xsd:sequence>
<xsd:element name="kanjiReading" type="xsd:string" minOccurs="0"
maxOccurs="unbounded" />
<xsd:element name="usage" type="xsd:string" maxOccurs="unbounded" />
<xsd:element name="kanjiReading" type="xsd:string" minOccurs="0"
maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="translationStringType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="language" type="xsd:language" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="relatedFormsType">
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:attribute name="id" type="xsdositiveInteger" use="required" />
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
--- schema ---
--- sample ---
<?xml version="1.0" encoding="utf-8"?>
<reference revision="0.1a" abridged="true">
<referenceEntry id="0" vulgar="false" colloquial="false"
archaic="false" juvenile="false">
<entry gender="neutral">
<verb verbConjugation="te-form" verbQuality="n/a" verbFormality="n/a" />??
</entry>
<definition language="en-us">after</definition>
<usageNotes language="en-us">This form expresses the order of a
sequece of 2 actions.</usageNotes>
<example trusted="true">
<japaneseSentence>
<ruby><rb>??</rb><rt>???</rt>?<rb>?</rb><rt>???</rt>??<rb>???</rb><rt>?????</rt>????<usage>??</usage><rb>?</rb><rt>?</rt>????</ruby>
</japaneseSentence>
<translatedSentence
</japaneseSentence>
<translatedSentence language="en-us">
I came today after breakfast.
</translatedSentence>
<source>Unknown</source>
</example>
<example trusted="true">
<japaneseSentence>
<ruby>????<rb>?</rb><rt>??</rt>???????<rb>?</rb><rt>??</rt>?<rb>??</rb><rt>????</rt>????<usage>??</usage><rb>?</rb><rt>?</rt>????</ruby>
</japaneseSentence>
<translatedSentence
</japaneseSentence>
<translatedSentence language="en-us">
After I become a little more skillful, I will buy such a guitar.
</translatedSentence>
<source>Unknown</source>
</example>
<example trusted="false">
<japaneseSentence>
<ruby>????<rb>??</rb><rt>??</rt>?<rb>?</rb><rt>?</rt>??<usage>??</usage><rb>?</rb><rt>?</rt>????</ruby>
</japaneseSentence>
<translatedSentence
</japaneseSentence>
<translatedSentence language="en-us">
After Godzilla ate the city, he went to sleep!
</translatedSentence>
<source>Unknown</source>
</example>
<relatedForms id="" />
</referenceEntry>
</reference>
--- sample ---