[
Lists Home |
Date Index |
Thread Index
]
- To: xml-dev@lists.xml.org
- Subject: Global element in XSD
- From: "Spencer Tickner" <spencertickner@gmail.com>
- Date: Tue, 7 Mar 2006 11:17:19 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=chL/rkUinIR9YdDMIZhJpZjAG1fhJfJveKIuK9TAqZJ9ICGNLPmfjgdmi5Q/7X4WI0/Enp/8Wvx5ZnmOVhpr0k4PaYSxHskXB6Iu3TiyQHBZRT9QLUkKJ8aye4eFRhBF98dLXP8P+9WLulbF5D2B/VymP/UfPR2czUk/ZNp8OWc=
Hi everyone,
I hope I'm posting to the correct list.. I've been looking for a
schema list to post my question and found that a few questions have
been asked here,, so hopefully I'm in the right spot.
My issue concerns having an element that can be placed anywhere. I my
context, which I think describes the problem well, I have a element
that indicates whether text in a document has changed. So for example
I here is a example schema:
<xsd:element name="_Inline" type="xsd:anyType" abstract="true"/>
<xsd:element name="italic" substitutionGroup="_Inline"/>
<xsd:element name="bold" substitutionGroup="_Inline"/>
<xsd:element name="new" substitutionGroup="_Inline"/>
<xsd:complexType name="Inline" mixed="true">
<xsd:sequence>
<xsd:element ref="_Inline" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="root">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="sentence">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="sentencenumber" type="Inline"/>
<xsd:element name="sentencetext" type="Inline"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="article">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="articlenumber" type="Inline"/>
<xsd:element name="articletext" type="Inline"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
Ok, so my <new> element is the one I'm concerned about. because I have
it as inline there is no problem putting it within number or text
elements.. However, whole sections of articles, sentences and both
could be <new>.
ex
<root>
<new>
<sentence>
<sentencenumber>1234</sentencenumber>
<sentencetext>This is some sentencetext</sentencetext>
</sentence>
<article>
<articlenumber>1235</articlenumber>
<articletext>Thsi is articletext</articletext>
</article>
</new>
<new>
<article>
<articlenumber>1235</articlenumber>
<articletext>Thsi is articletext</articletext>
</article>
</new>
</root>
Right, so I know I could go through the process of declaring the <new>
element for every possible occurence throughout the schema, but my
real schema is a wack larger than the snippit above, so I'm really
hope there's another way of saying "This element may be found
ANYWHERE"..
Any thoughts would be greatly appreciated.
Thank you
|