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/04 13:10:01 UTC

deriving information about locally defined elements in XML-schema

Dear XMLBeaners,

I just started with XMLBeans.

>From within a Java program I am reading an XML-Schema (for excercise, I
started with the easypo.xsd example).
For that Schema, I want to make an inventory of all elements (not only
those globally defined), attributes, the children of each element etc..

I already found out how I can retrieve all globally defined elements,
attributes and complexType definitions, using:

SchemaGlobalElement[] sge = sts.globalElements();
SchemaGlobalAttribute[] sga = sts.globalAttributes();
SchemaType[] gt = sts.globalTypes();
for(int i=0; i<gt.length; i++) {
	if(gt[i] != null) {
		SchemaParticle particle = gt[i].getContentModel();
		if(particle != null) showParticleInfo(particle);  // recursive method
to find children
	}		
}

What I did not find out yet is how to find all children and their
attributes of a globally defined element, e.g. as in:
  <xs:element name="purchase-order">  <!-- globally defined element -->
    <xs:complexType>
      <xs:sequence>
        <xs:element name="customer" type="po:customer"/>
        <xs:element name="date" type="xs:dateTime"/>
        <xs:element name="line-item" type="po:line-item" minOccurs="0"
maxOccurs="unbounded"/>
        <xs:element name="shipper" type="po:shipper" minOccurs="0"
maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
I.e. how can I retrieve the information about the locally defined
elements "customer", "date", "line-item" and "shipper" ?

Many thanks in advance,

Jozef

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