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 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: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>
</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" xmlns:pl="http://www.aa.com/list" xmlns:xs="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>
<!-- -*- nxml -*- -->
<xs:schema targetNamespace="http://www.aa.com/list" xmlns:pl="http://www.aa.com/list" xmlns:xs="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>

