By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,541 Members | 1,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,541 IT Pros & Developers. It's quick & easy.

JAXB Parsing problem

P: n/a
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="66454" channelrunid="1"
channeltype="publication" familyid="66104" status="2"
websitename="rc.com" />
<event eventid="2" channelid="66454" channelrunid="2"
channeltype="publication" familyid="66147" status="1"
websitename="rc.com"/>
<event eventid="3" channelid="22222" channelrunid="1"
channeltype="publication" familyid="66104" status="1"
websitename="rc.com"/>
<event eventid="4" channelid="22222" channelrunid="1"
channeltype="publication" 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"
elementFormDefault="qualified">
<xs:complexType name="eventType">
<xs:attribute name="eventid" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
<xs:enumeration value="3"/>
<xs:enumeration value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="channelid" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="22222"/>
<xs:enumeration value="66454"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="channelrunid" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="channeltype" type="xs:string" use="required"/>
<xs:attribute name="familyid" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="66104"/>
<xs:enumeration value="66147"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="status" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="websitename" type="xs:string" use="required"/>
</xs:complexType>
<xs:element name="websitedetails">
<xs:complexType>
<xs:sequence>
<xs:element name="event" type="eventType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.