​Hello,

​
​I am trying to use JiBX to parse a larger XML, which includes a structure
similar to the ones noted below:

Schema:
<xs:complexType name="Parent">
    <xs:sequence>
        <xs:element name="ChildElem" maxOccurs="unbounded">
            <xs:complexType>
                <xs:attribute name="ChildElemValue" type="xs:string"
use="required"/>
            </xs:complexType>
        </xs:element>
    </xs:sequence>
    <xs:attribute name="Child1" type="xs:string"/>
    <xs:attribute name="Child2" type="xs:int"/>
</xs:complexType>

Sample Value:
<Parent Child1="AttrVal" Child2="999">
    <ChildElem ChildElemValue="SomeVal"/>
    <ChildElem ChildElemValue="SomeVal2"/>
</Parent>​


The equivalent class I am trying to map this to is:
public class Parent {
    private String child1;
    private int Child2;
    private List<String> childElems;
}

I am trying to write a mapping for marshalling and unmarshalling, without
requiring a class to represent the ChildElem, because all it will ever have
is a string in the ChildElemValue attribute.

I am open to (but not experienced with) custom Marshaller / Unmarshaller,
and if so, I would like to reuse them as much as possible, as there are
similar structures as above (with different element / attribute names) all
over the project.

Any help or direction in accomplishing this would be greatly appreciated.

Regards,
Bindul​
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to