I'm sorry for confusing you.
I'm volunteering but I don't know very well about parsing xml schema.

I'm fixing getMinOccurs method in Schemas class.
I'd like to make sure it is ok because Schemas class is really core in
GeoTools.

*Before*
if (decl == fElement) {
  if (particle.isSetMinOccurs()) {
    minOccurs.add(new Integer(particle.getMinOccurs()));
  } else if (particle.getContainer() instanceof XSDModelGroup
                  && particle.getContainer().getContainer() instanceof
XSDParticle) {
       particle = (XSDParticle) particle.getContainer().getContainer();
       minOccurs.add(new Integer(particle.getMinOccurs()));
  } else {
       minOccurs.add(1);
  }
}

*After*
if (decl == fElement) {
  if (particle.isSetMinOccurs()) {
      minOccurs.add(new Integer(particle.getMinOccurs()));
  } else if (particle.getContainer() instanceof XSDModelGroup) {
      XSDModelGroup modelGroup = (XSDModelGroup) particle.getContainer();
      if(modelGroup.getContainer() instanceof XSDParticle) {
        particle = (XSDParticle) modelGroup.getContainer();
        minOccurs.add(new Integer(particle.getMinOccurs()));
      }
      else {
        int compositor = modelGroup.getCompositor().getValue();
        int min;
        switch(compositor) {
          case XSDCompositor.ALL:
          case XSDCompositor.CHOICE: 
              min = 0;
              break;
           case XSDCompositor.SEQUENCE:
           default:
              min = 1;
              break;
         }
         minOccurs.add(min);
      }
  } else {
      minOccurs.add(1);
  }
}

when parsing group element, I think that meaning of order indicator is
disappeared.
for example, following group definition has the <choice> indicator.

<xs:group name="CellSpaceGeometry">
<xs:choice>
<xs:element name="Geometry3D" type="gml:SolidPropertyType"/>
<xs:element name="Geometry2D" type="gml:SurfacePropertyType"/>
</xs:choice>
</xs:group>

but after parsing by using getMinOccurs method, minOccurs value of
AttributeDescriptor become "1".
I think it should be "0" in this case.

Hyung-Gyu.




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Mutliplicity-of-AttributeTypeDescriptor-problem-when-parsing-elements-in-xsd-choice-tp5276520p5276796.html
Sent from the geotools-devel mailing list archive at Nabble.com.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to