This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Services and the fly likes how to decode xml special character coming from soap web service value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "how to decode xml special character coming from soap web service value" Watch "how to decode xml special character coming from soap web service value" New topic
Author

how to decode xml special character coming from soap web service value

vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
can any body tell how to decode the xml special character like <>" coming from web service value ? I want to parse the value so i have to replace



Thanks
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1164
XML strongly suggests using UTF-8. The Basic Profile Version 1.0 says -


The Profile consistently requires either UTF-8 or UTF-16 encoding for both SOAP and WSDL (see also R1012).

R4003 A DESCRIPTION MUST use either UTF-8 or UTF-16 encoding.


What's the special character we are talking about?

Regards,
Dan

William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Either wrap the element value that contains the "<" and/or ">" characters in a CDATA section. Reference: http://www.w3schools.com/XML/xml_cdata.asp
...or use the characters "& lt;" (without the space after the ampersand) instead of "<" and "& gt;" (again without the space after the ampersand) instead of ">".
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1164
Right, Ivan is right, please look at Predefined entities in XML.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to decode xml special character coming from soap web service value
 
Similar Threads
Special Characters
special character in xml
XML Escape Newline Characters
Java for log in authentication? (looking for tutorial that applies to situation)
Struts2 variable inside javascript