You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by "Butt, Ian" <ib...@metasolv.com> on 2005/10/26 16:10:01 UTC

Problem with calling getParticleChildren method

I am having a problem with the getParticleChildren method call below when I have one element in my sequence the spArray is null, but if I add another element in the sequence(see just below - newListEntries complex type), the array returns the two elements.  From reading the JavaDoc it appears like it should return one element if only one defined.  
 
Thanks,
 
Ian
public   <http://xmlbeans.apache.org/docs/2.0.0/reference/org/apache/xmlbeans/SchemaParticle.html> SchemaParticle[] getParticleChildren()

Applies to sequence, choice, and all particles only: returns an array of all the particle children in order. 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
 <xs:complexType name="newListEntries">
  <xs:sequence>
   <xs:element name="listEntry" type="pl:listEntry" minOccurs="0" maxOccurs="unbounded"/>
   <xs:element name="listEntryDummy" type="pl:listEntry" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
 </xs:complexType>

 
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
 
SchemaParticle contentModel = ListEntriesDocument.type.getContentModel().getType().getContentModel()
SchemaParticle[] spArray = contentModel.getParticleChildren();
 
 
<?xml version="1.0" encoding="UTF-8"?>
<!-- -*- nxml -*- -->
<xs:schema targetNamespace="  <http://www.aa.com/list> http://www.aa.com/list"  xmlns:pl="  <http://www.aa.com/list> http://www.aa.com/list" xmlns:xs="  <http://www.w3.org/2001/XMLSchema> http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
 
 <xs:complexType name="listEntry">
  <xs:sequence>
   <xs:element name="ge" type="xs:string" minOccurs="0"/>
   <xs:element name="le" type="xs:string" minOccurs="0"/>
   <xs:element name="sequence" type="xs:integer" minOccurs="0"/>
  </xs:sequence>
 </xs:complexType>
 
 <xs:complexType name="listEntries">
  <xs:sequence>
   <xs:element name="listEntry" type="pl:listEntry" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
 </xs:complexType>
 
 <xs:element name="listEntries" type="pl:listEntries"/>
</xs:schema>