Reputation: 3148
I have xml file and I want to create set of classes based on it with JAXB annotations, which will be used to un-marshall XML files.
XML:
<widgetOutput>
<dataItems>
<dataItem><isLimit>false</isLimit></dataItem>
<dataItem><size>1000</size></dataItem>
<dataItem><key>Canada</key><value>1</value></dataItem>
<dataItem><key>US</key><value>2</value></dataItem>
<dataItem><key>Italy</key><value>3</value></dataItem>
<dataItem><key>France</key><value>4</value></dataItem>
...
<dataItem><key>some_N_key_here</key><value>some_N_value_here</value></dataItem>
<status>complete</status>
</dataItems>
</widgetOutput>
I can't modify this xml, it is being generated byt he web service. Please advise how classes along with annotations may look like. Thanks in advance.
Upvotes: 0
Views: 174
Reputation: 38152
Use tools such as the ones provided by NetBeans to create all necessary classes from a WSDL file.
Or use a Maven plugin if you're using Maven.
Upvotes: 0
Reputation: 32969
Consider creating a schema for the expected XML and using XJC to create the Java classes for you.
Upvotes: 1