[Simple-support] How to parse xml into objects I can use to build a richfaces tree?
Brought to you by:
niallg
|
From: meghiddo <mat...@ho...> - 2009-05-28 14:12:14
|
The xml looks like this:
[code]<deviceCollection>
<device>
<deviceId>exampleDevice1</deviceId>
<name>Example Device 1</name>
</device>
</deviceCollection>[/code]
I have a readXml method already:
[code]public DeviceCollection readXML(InputStream xml) throws Exception {
Serializer serializer = new Persister();
DeviceCollection deviceCollection = null;
deviceCollection = serializer.read(DeviceCollection.class, xml);
xml.close();
return deviceCollection;
}
[/code]
And here is my method where I am attempting to bind this data:
[code]static String devicesUrl =
"http://webc-apps.ni.com/measure/1.01/devices";
public static void updateNode() throws IOException, Exception {
// Create an instance of HttpClient.
HttpClient client = new HttpClient();
// Create a method instance.
GetMethod method = new GetMethod(devicesUrl);
XMLTreeDataBuilderTest node = new XMLTreeDataBuilderTest();
DeviceCollectionXMLAO access = new DeviceCollectionXMLAO();
DeviceCollection deviceCollection;
deviceCollection = access.readXML(method.getResponseBodyAsStream());
[/code]
I am not sure where I am going wrong here. All I really know is I am
needing to take the values from the deviceid node and name node, and bind
them to something which I can then use in my jsf page to build a tree.
It has to be dynamic as well, because that xml from the top is going to be
different depending on the user..
please help, Ive been at this for a week and havent made much progress
--
View this message in context: http://www.nabble.com/How-to-parse-xml-into-objects-I-can-use-to-build-a-richfaces-tree--tp23762343p23762343.html
Sent from the Simple XML Serialization mailing list archive at Nabble.com.
|