The
way this works is:
- if
you have just one element, then the particle _is_ that element, i.e. there are
no sequences with only one child
- if
you have two or more elements, then the particle is a sequence and then its
children are indeed the two elements
You
can use
public
int getParticleType()
to
check what case you're in.
Radu
-----Original Message-----
From: Butt, Ian [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 7:10 AM
To: [email protected]
Subject: Problem with calling getParticleChildren methodI 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,Ianpublic 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" 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>

