← Prev in month ← Prev in thread
Next in thread → Next in month →

Global element in XSD

From
Spencer Tickner <>
To
Date
2006-03-07T19:17:19Z
ID
<>
Thread
Global element in XSD
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
← Prev in month ← Prev in thread
Next in thread → Next in month →