You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ecs-user@jakarta.apache.org by da...@highmark.com on 2003/04/21 20:56:23 UTC

Outputting Entity References for special Characters.




Is there anyway to have special characters embedded in an XML element be
outputted using the character's entity reference when either using the
XML.toString() method or the XMLDocument.output(OutputStream) method? For
example:

XMLDocument doc = new XMLDocument();
XML element = new XML("test");
element.setTagText("lets see how the less than sign is outputted: <");
doc.addElement(element);

OutputStream os = new ByteArrayOutputStream();
doc.output(os);

System.out.println(element);
System.out.println(os);

Output produced by the above:
<test>lets see how the less than sign is outputted: <</test>
<?xml version="1.0" standalone="yes"?><test>lets see how the less than sign
is outputted: <</test>

Whereas I would really like the output to look like this:
<test>lets see how the less than sign is outputted: &lt;</test>
<?xml version="1.0" standalone="yes"?><test>lets see how the less than sign
is outputted: &lt;</test>

Thanks.
_______________________
David Howie
Customer Service Systems
(717) 731-2513
david.howie@highmark.com


---------------------------------------------------------------------
To unsubscribe, e-mail: ecs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: ecs-user-help@jakarta.apache.org