You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by jo...@xml4pharma.com on 2005/04/16 19:32:01 UTC
finding xs:unique information from XML-Schema
I have an XML schema with:
<xs:unique name="UC-O-1">
<xs:selector xpath="Study" />
<xs:field xpath="@OID" />
</xs:unique>
and:
<xs:element name="Study">
<xs:complexType>
<xs:sequence>
...
</xs:sequence>
</xs:complexType>
<xs:attribute name="OID" type="oid" use="required" />
</xs:element>
Now after compiling the schema, I am trying to retrieve the xs:unique
information from the XML-Schema.
I tried using:
SchemaGlobalElement[] sge = sts.globalElements(); // sts is the
SchemaTypeSystem
SchemaGlobalElement[] sge = sts.globalElements();
for(int i=0; i<sge.length;i++) {
SchemaProperty[] attributes =
sge[i].getType().getAttributeProperties();
for(int j=0; j<attributes.length; j++) {
System.out.println("with ID constraint = " +
sts.findIdentityConstraintRef(attributes[j].getName()));
}
}
but I always get null for each attribute.
Is this the way to go, or is there a way to find all constraints at once
?
Anyone having an example or code snippet ?
Many thanks in advance
Jozef Aerts
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org