ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Man, Tsjok-Wing" <>
Subject RE: [Newbie Question]Parsing a text/xml result
Date Fri, 05 Mar 2004 09:58:39 GMT

The xmlrpc.execute call will create the necessary structures automatically
for you. There's a list of mappings between Java types and XMLRPC-types in
the documentation somewhere. You don't have to parse the XMLRPC response
yourself, that's what the xmlrpc-library is for! 

for example the following response:

This will be automatically mapped by xmlrpc to a Vector containing two

So your code will need to cast the result to a Vector first:
Vector result;

result = (Vector) xmlrpc.execute ("", params);

And to get the info out:
Iterator results;
results = result.iterator();
while (results.hasNext()) {
	Hashtable organisation = (Hashtable);
	System.out.println("org name: " + organisation.get("org"));
	System.out.println("org country: " + organisation.get("country"));

This will print:
org name: Foo
org country: Holland
org name: Bar
org country: UK

Hope this helps,



drs. Tsjok-Wing Man 
Ordina Software Integration & Development 
Consultant ICT 
Ordina SI&D Technology Consulting    Tel: (033) 434 16 00 
Plotterweg 1                         Fax: (033) 494 58 45 
3821 BB Amersfoort                   GSM:  06 53 37 56 05 
URL:           Email: 
-----Oorspronkelijk bericht-----
Van: bagas []
Verzonden: vrijdag 5 maart 2004 10:55
Onderwerp: [Newbie Question]Parsing a text/xml result

Dear all,
Suppose I have sent a remote procedure call
String result = (String) xmlrpc.execute ("", params);
And get result. 
The result itself is a String containing a XML-RPC message.
The Question is how can I extract the Result XML to Vector or an array?
Thank you very much.

View raw message