JAXB Parsing problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • my_questions

    JAXB Parsing problem

    Hi I am new to JAXB.

    I am trying to unmarshal a XST. I have looked into many examples and
    they provide to unmarshal if we have a XST with Tags withing Tags.
    However I have an XST where I have a element with many attributes.

    Here I am attaching my XML and XST.

    Please provide me how I should unmarshal and use this XST.

    Thanks,

    XML :

    <websitedetails >
    <event eventid="1" channelid="6645 4" channelrunid="1 "
    channeltype="pu blication" familyid="66104 " status="2"
    websitename="rc .com" />
    <event eventid="2" channelid="6645 4" channelrunid="2 "
    channeltype="pu blication" familyid="66147 " status="1"
    websitename="rc .com"/>
    <event eventid="3" channelid="2222 2" channelrunid="1 "
    channeltype="pu blication" familyid="66104 " status="1"
    websitename="rc .com"/>
    <event eventid="4" channelid="2222 2" channelrunid="1 "
    channeltype="pu blication" familyid="66147 " status="1"
    websitename="rc .com"/>
    </websitedetails>

    XST

    <?xml version="1.0" encoding="UTF-8"?>
    <!--W3C Schema generated by XMLSPY v5 rel. 2 U
    (http://www.xmlspy.com)-->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefa ult="qualified" >
    <xs:complexTy pe name="eventType ">
    <xs:attribute name="eventid" use="required">
    <xs:simpleTyp e>
    <xs:restricti on base="xs:NMTOKE N">
    <xs:enumerati on value="1"/>
    <xs:enumerati on value="2"/>
    <xs:enumerati on value="3"/>
    <xs:enumerati on value="4"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="channelid " use="required">
    <xs:simpleTyp e>
    <xs:restricti on base="xs:NMTOKE N">
    <xs:enumerati on value="22222"/>
    <xs:enumerati on value="66454"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="channelru nid" use="required">
    <xs:simpleTyp e>
    <xs:restricti on base="xs:NMTOKE N">
    <xs:enumerati on value="1"/>
    <xs:enumerati on value="2"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="channelty pe" type="xs:string " use="required"/>
    <xs:attribute name="familyid" use="required">
    <xs:simpleTyp e>
    <xs:restricti on base="xs:NMTOKE N">
    <xs:enumerati on value="66104"/>
    <xs:enumerati on value="66147"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="status" use="required">
    <xs:simpleTyp e>
    <xs:restricti on base="xs:NMTOKE N">
    <xs:enumerati on value="1"/>
    <xs:enumerati on value="2"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="websitena me" type="xs:string " use="required"/>
    </xs:complexType>
    <xs:element name="websitede tails">
    <xs:complexType >
    <xs:sequence>
    <xs:element name="event" type="eventType " maxOccurs="unbo unded"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>
Working...