XML Parsing Question
I am reading the input stream from an HTTP Post. The data is coming in XML format. The incoming document looks like this:
<transaction>
<user>USERNAME</user>
<password>PASSWORD</password>
<form>FORMNAME</form>
<xmldoc>
<request>
<partner>PARTNERNAME</partner>
<fields>
<field id="536871007">DATA</field>
</fields>
</request>
</xmldoc>
</transaction>
I am able to parse out the user, password, and form data, but not the xmldoc tag. I want to get everything under and including the request tag and then store that. I am using JDOM. So far I have:
ServletInputStream in = req.getInputStream();
Document doc = builder.build(in);
Element root = doc.getRootElement();
RequestData rd =new RequestData();
rd.setFormName(root.getChildText("form"));
rd.setPassword(root.getChildText("password"));
rd.setUser(root.getChildText("user"));
Element xmldoc = root.getChild("xmldoc");
req is my HTTPServletRequest object and rd is a custom data class. The closest i have come is to use xmldoc.getValue, but that strips out my XML tags, and i want to preserve them along with the data inside them. I just want to parse out
<request>
<partner>PARTNERNAME</partner>
<fields>
<field id="536871007">DATA</field>
</fields>
</request>
and store it.
Thanks.

