GeeCON Prague 2014*
The moose likes Java in General and the fly likes how to read info from a class which has xml data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "how to read info from a class which has xml data" Watch "how to read info from a class which has xml data" New topic
Author

how to read info from a class which has xml data

Sandeep Suram
Greenhorn

Joined: Feb 22, 2011
Posts: 7
can i know how to extract pass through parameters from a class. this class parses a xml file and has that data. below is the class

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="indexQuery")
public class Item implements Serializable {

private String id = UUID.randomUID().toString();

@XmlElementWrapper(name = "itemParameters")
@XmlElement(name = "itemField")
private List<ItemField> itemFields = new ArrayList<ItemField>(); // 'field' elements in this query

private Map<String, String> passThroughInfo = new HashMap<String, String>(); // 'field' element name/value pairs

public String getId() {
return id;
}


public List<ItemField> getItemFields() {
return itemFields;
}
public void setItemFields(List<ItemField> itemFields) {
this.itemFields = itemFields;
}
public Map<String, String> getPassThruInfo() {
return passThruInfo;
}
public void setPassThroughInfo(Map<String, String> passThroughInfo) {
this.passThroughInfo = passThroughInfo;
}
}

below is the sample xml..

<?xml version="1.0"?>
<inquiry priority ="5">
<object name="xyz" />
<indexquery range="N">
<field name="z" />
<field name="p" low="3" />
</indexquery>
<indexquery range="N">
<field name="g" />
<field name="m" low="3"/>
</indexquery>
 
GeeCON Prague 2014
 
subject: how to read info from a class which has xml data