[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: Global elements XSD
  • From: "Spencer Tickner" <spencertickner@g...>
  • Date: Tue, 7 Mar 2006 11:31: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=gCBWlMo7SWhgQGRYO9EtJFvUIuxFRkgAT4hqSE26M7iP+lec73pMoDGxHphqoCotjFbAIM5DoV5IbjlXtoZ16SUpAZIT3lcv1njnrguExWN3OEhRwMWrDM5OXFnJ35FpiHnO6QXrIrGOcIW7/1PlsaAVbSNfJuAtM1uoDrMFdrU=

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

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member