xsd-reader
xsd-reader copied to clipboard
Keeping the order of a mixed sequence
Hi,
I'm currently working on a project where a complex type may contain a sequence of mixed types, i.e.
<choice maxOccurs="unbounded">
<element name="label" type="ns:labelType"/>
<element name="text" type="ns:textType"/>
<element name="select" type="ns:selectType"/>
<element name="checkbox" type="ns:checkboxType"/>
</choice>
The generated classes nicely group them into different attributes BUT I really need to keep track of the actual order of those in the XML I'm parsing. Is there any way to do this using xsd2php?
getElements() Should return the elements in the same order as in the XSD, does it help?
But in general, XSD is a type system much more powerful than PHP, so some features most probably are not available.
Maybe I should clarify this a bit. I need to retain the order of the elements stated in the XML, i.e. I need an array of type (labelType|textType|selectType|checkboxType)[] after deserialization.
My best guess is that this can be done by using a custom class for the complex type.
I guess so... but this kind of edge cases are not handled already..