I'm using JDOM for the first time and so far, not very successfully. Also, I'm a .NET guy who was assigned a Java project.
I have this xml file and I'm trying to read all the elements.
This is the code I have so far. The response is where I get the xml data. I can read the root element, but I'm struggling to read the elements. Any ideas??
JSONObject ticket = data.getDataJSON();
String id = ticket.getString(SDPTicketKeyValues.Key.ID);
String input_data = "";
Content response = Request
.Post(REST_URL + REQUEST_RESOURCE + id + "/" + NOTES_RESOURCE)
.bodyForm(
Form.form().add(TECHKEY_PARAMETER, MYTECH_KEY)
.add(OPERATION_PARAMETER, GETNOTES_OPERATION)
.add("INPUT_DATA", input_data)
.build())
.execute().returnContent();
SAXBuilder builder = new SAXBuilder();
StringReader reader = new StringReader(response.asString());
Document document = (Document) builder.build(reader);
Element rootNode = document.getRootElement();
This is the xml file
<?xml version="1.0" encoding="UTF-8"?>
<API version="1.0">
<response>
<operation name="GET_NOTES">
<result>
<statuscode>200</statuscode>
<status>Success</status>
<message>Notes details fetched successfully.</message>
</result>
<Details>
<Notes>
<Note URI="http://localhost:8080/sdpapi/request/10/notes/901/">
<parameter>
<name>isPublic</name>
<value>false</value>
</parameter>
<parameter>
<name>notesText</name>
<value>dfgfdgdfgdfgdgdgdgdgdg</value>
</parameter>
<parameter>
<name>userName</name>
<value>Howard Stern</value>
</parameter>
<parameter>
<name>notesDate</name>
<value>1373971580200</value>
</parameter>
</Note>
<Note URI="http://localhost:8080/sdpapi/request/10/notes/612/">
<parameter>
<name>isPublic</name>
<value>false</value>
</parameter>
<parameter>
<name>notesText</name>
<value>dfgdfgdfgdfgdfgdfgdfgdf</value>
</parameter>
<parameter>
<name>userName</name>
<value>Howard Stern</value>
</parameter>
<parameter>
<name>notesDate</name>
<value>1373967102396</value>
</parameter>
</Note>
<Note URI="http://localhost:8080/sdpapi/request/10/notes/611/">
<parameter>
<name>isPublic</name>
<value>true</value>
</parameter>
<parameter>
<name>notesText</name>
<value>dfgdfgdfgdfgdfgdfgdgdgdgd</value>
</parameter>
<parameter>
<name>userName</name>
<value>Howard Stern</value>
</parameter>
<parameter>
<name>notesDate</name>
<value>1373967097117</value>
</parameter>
</Note>
</Notes>
</Details>
</operation>
</response>
</API>