Question

I have parsed wsdl files with the help of WSDL4J, JDOM and Castor libraries. Now, I can get the complex types but still can not access the elements in its sequence.

<xs:element name="AddInstanceGroupsResult">
    <xs:complexType>

        <xs:annotation>
          <xs:documentation><![CDATA[
              <p>Output from an AddInstanceGroups call.</p>
           ]]></xs:documentation>
        </xs:annotation>

      <xs:sequence>
        <xs:element name="JobFlowId" type="tns:XmlStringMaxLen256" minOccurs="0">

          <xs:annotation>
            <xs:documentation><![CDATA[
                <p>The job flow ID in which the instance groups are added.</p>
             ]]></xs:documentation>
          </xs:annotation>

        </xs:element>
        <xs:element name="InstanceGroupIds" type="tns:InstanceGroupIdsList" minOccurs="0">

          <xs:annotation>
            <xs:documentation><![CDATA[
                <p>Instance group IDs of the newly created instance groups.</p>
             ]]></xs:documentation>
          </xs:annotation>

        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

For example, I can reach AddInstanceGroupsResult as a complex type, but I can not get the basic elements in it (JobFlowId and InstanceGroupIds)..

case Structure.MODELGROUP:
Group modelGroup = (Group)ct;
ContentModelGroup contentModel = modelGroup.getContentModelGroup();
int count = contentModel.getParticleCount();
for (int n=0; n< count; n++){
    ElementDecl elementDecl2 = (ElementDecl)contentModel.getParticle(n);


    result.add(elementDecl2.getName());
    resultLong.add(parseParameterName(elementDecl2.getName()));
    resultType.add(elementDecl2.getType().getName());

}

Any suggestions? Thanks..

No correct solution

OTHER TIPS

You will need to do something like:

Sequence seq = ct.getSequence();

Then once you've done that you can get the elements in that sequence like you would for the elements in the Complex Type itself i.e.

for(Element el : seq.getElements())
{
     //do stuff
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top