> Hello,
>
> I'm new to the world of XML.
> I have a web service that returns a String of XML data.
> I need to be able to encode that String so that when it gets validated
> by the client it will be in a valid XML format.
I can think of two interpretations of your problems.
(1) You want have an XML document which you want to pass to the client.
Solution: just pass it to the client. Presumably, it's already valid XML, or
else that web server you have is broken.
(2) Your client is expecting a XML encoded response which semantically
represents a string. It just so happens that coincidentally, this content is
XML data.
Solution: Escape the relevant characters.
For example, if you want to return the String which represents the following
XML document:
<XmlDocument>Hello World!</XmlDocument>
then escape the string as follows:
"<XmlDocument>Hello World!</XmlDocument>"
and then put that string within your XML response:
<XmlResponse type="string"><XmlDocument>Hello
World!</XmlDocument></XmlResponse>
and then your problem reduces to (1) which was already solved.
- Oliver