You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by S <st...@cyberspace.org> on 2002/01/17 06:23:55 UTC

subset of enumerations


How do I write a schema def for an element which can occur 0 through 5 times,
each time taking its value from a enumerated set, and the each element
being distinct.

for eg, I want a subset of size 5 from {1,2,3,4,5,6,7,8,9,0}.
<int>2</int>
<int>3</int>
<int>6</int>
<int>9</int>
<int>0</int>

how do I write an xsd for this?

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


How to construct a document object...Help

Posted by Ragunath Marudhachalam <rm...@circuitvision.com>.
Hi all,

Could any one help me how to construct a Document object from a inputstream
using xerces....

Ragu
CircuitVision



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: subset of enumerations

Posted by Eddie Robertsson <ed...@allette.com.au>.
> How do I write a schema def for an element which can occur 0 through 5 times,

by using the minOccurs and maxOccurs attributes:

<xs:element name="int" minOccurs="0" maxOccurs="5">

> each time taking its value from a enumerated set,

by creating an enumeration datatype:

<xs:simpleType name="enum">
   <xs:restriction base="xs:string">
      <xs:enumeration value="1"/>
      <xs:enumeration value="2"/>
   </xs:restriction>
</xs:simpleType>

or in your case it's actually easier to do:

<xs:simpleType name="enum">
   <xs:restriction base="xs:nonNegativeInteger">
      <xs:maxInclusive value="9"/>
   </xs:restriction>
</xs:simpleType>


> and the each element being distinct.

define a xs:unique for the element which will ensure uniqueness.

<xs:element name="wrapper">
   <xs:complexType>
      <xs:sequence>
         <xs:element name="int" minOccurs="0" maxOccurs="5">
      <xs:sequence>
   </xs:complexType>
   <xs:unique name="unique1">
      <xs:selector xpath="int"/>
      <xs:field xpath="."/>
   </xs:unique>
</xs:element>

Cheers,
/Eddie

> for eg, I want a subset of size 5 from {1,2,3,4,5,6,7,8,9,0}.
> <int>2</int>
> <int>3</int>
> <int>6</int>
> <int>9</int>
> <int>0</int>
>
> how do I write an xsd for this?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org