Hi,
I have a variable of type Object, which is obtained from an xml-rpc call like:
Object[] params = new Object[]{new Double(4.0), new Double(5.0)};
Object result = client.execute( "foobar.add", params );
and I know that it contains this xml data:
<methodResponse>
<params> <param>
<value><struct>
<member><name>value1</name> <value><double>4.2</double></value> </member>
<member><name>value2</name> <value><double>9.6</double></value> </member>
<member><name>product</name> <value><double>13.8</double></value> </member>
</struct></value>
</param> </params>
</methodResponse>
I also tested it this way:
System.out.println(result.toString());
and I got the result as:
{product=9.0, value1=4.0, value2=5.0}
I tried to parse it to xml which didn't work in my way:
DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(result.toString()));
Document doc = db.parse(is);
NodeList nodes = doc.getElementsByTagName("member");
and generated error which I couldn't figure it out, why it can't read the output string of the "result"!
What I need is, to insert the obtained data to a database, and I don't know how to extract these obtained values for my table filed in the database!
Could anybody help me to find out, what is the easiest method to extract data and insert to the database?
Thank you!