PDA

View Full Version : Escaping node content


sfarrow
10-17-2003, 09:33 AM
When I serialize() a datapointer, I lose any escaping that had previously been present. For example,

<dataset name="myds">
<mynode>1 &amp; 2</mynode>
</dataset>

would serialize as:

<dataset name="myds">
<mynode>
1 & 2</mynode>
</dataset>

which is not well-formed XML. I use serialize() to prepare params to be passed in the queryString of a dataset request. Is there any way I can preserve the escaping (or reescape the node content with the entity codes) so that I am passing valid XML?

Steve.

antun
10-17-2003, 09:47 AM
How are you confirming this - is the client definately sending the unescaped XML over for sure, or are you seeing this in the debugger?

The reason I ask is I want to make sure it's not the debugger escaping the XML.

-Antun

sfarrow
10-17-2003, 09:56 AM
I am seeing it in the debugger as well as from my webservice which chokes on it when it tries to parse it.

antun
10-17-2003, 11:51 AM
This has turned out to be a known bug - there's no way of preventing this unescaping, unless you turn those text nodes into CDATA nodes:


<canvas debug="true">

<dataset name="myds">
<mynode><![CDATA[1 &amp;amp; 2]]></mynode>
</dataset>

<simplelayout spacing="10" />

<inputtext name="foo" width="200" multiline="true" height="150" />

<button>
<method event="onclick">
debug.write( myds.getPointer().serialize() );
foo.setText( myds.getPointer().serialize() );
</method>
</button>
</canvas>

antun
10-17-2003, 11:52 AM
... you could also write your own serialize function that took a datapointer that navigated its way through the XML hierarchy and concatanated a string that way.

-Antun