XML Character escaping
It seems the XML.table object cannot handle the '<' character.
Using this 'escaped' XML string cause the columns to get mixed up
<Rows>
<Row>
<CUSTOMER_NAME>K-Line Europe</CUSTOMER_NAME>
<MATCH_SCORE>123</MATCH_SCORE>
<APP_PKEY>H"1 X<VH !</APP_PKEY>
<APPLICATION_NAME>EMEA_ACT</APPLICATION_NAME>
</Row>
</Rows>
Sending the same <Row> node twice in the same input XML string causes the whole grid to flash!
It seems to escape other reserved XML characters but not '<'
Any ideas?
Matt B
May 19,
Updated:
The actual pattern it cannot handle inside the Text Node is '<[alpha char]'
'<1' is OK - '<V' is not
Matt
Matt B
May 19,
Try using :
<Rows>
<Row>
<CUSTOMER_NAME>K-Line Europe</CUSTOMER_NAME>
<MATCH_SCORE>123</MATCH_SCORE>
<APP_PKEY><![CDATA[ ... any test you want in here ... ]]></APP_PKEY>
<APPLICATION_NAME>EMEA_ACT</APPLICATION_NAME>
</Row>
</Rows>
Alex H
May 20,
Sorry : Any TEXT you want between <![CDATA[ and ]]>
Alex H
May 20,
That works - just added a bit of code in my servlet to surround those characters
Thanks
Matt
Matt B
May 20,
When I use:
<Company Name><![CDATA[<Microsoft]]></Company Name> - it doesn't work
I have to escape the "<" character and wrap it in a CDATA to get it to work:
<Company Name><![CDATA[<Microsoft]]></Company Name>
I've tried this in the examples. I don't want to parse every data string and escape special characters. Anybody know what's going on or how to solve this?
Thanks!
Don
July 19,
To start, you have to look at every string you send to the browser and escape the odd characters unless you want bizzare behavior when a string contains 'special' characters. This is basic JavaScript programming. The hardest bugs I have had to track down in my applications center around the fact that a 'special' character has made it into the browser and broke my HTML or JavaScript. My local testing works fine, but the client database is different so they are hitting a record in the table that I don't have which has this special character and the application breaks for them but works fine for me. Unless you like debugging strange behavior and pulling your hair out, I suggest that you escape all strings sent to the browser.
Jim Hunter
July 19,
Thanks for the response Jim.
I guess I didn't understand CDATA. I thought that was being used in a way to avoid having to escape characters manually.
I was hoping I could just wrap CDATA around all my data fields and not worry about looking for special characters.
On another note, how can you possibly handle every special character? A lot of "if" blocks?
Don
July 20,