wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to read info from a class which has xml data
 
Similar Threads
JSF 2.0 and AJAX Problem
put in LIST Sample Data to debug, also how view SQLITE DB Data from Eclipse IDE for debug purposes
@ManyToOne - extra column?
Help me in understanding a code with one to many
Parsing xml file using sax parser-NULLPOINTEREXCEPTION