Forum > General

XML parsing of ampersand character

(1/1)

c600g:
I am using ReadXMLFile() to parse a string stream containing XML. One of the attributes I am parsing includes a properly escaped ampersand character ("&"). When I get the attribute value, the entity is automatically converted to "&" in the string. Is there a way to prevent this from happening?

Thanks much,
  Alan

winni:
Hi!

Double the escaped ampersand:

&&

Or if it is inside an URL then use the hexadecimal value:

%26


Winni

c600g:
Winni,

Thanks for the reply. However, I cannot control the input values to this attribute - they are sent in by a calling application over which I have no control. I simply want the attribute's value to *not* convert the "&" to "&" when I get the node's value (using TDOMNode.NodeValue).

Cheers,
  Alan

SymbolicFrank:
I think it should work if you include laz2_XMLRead, instead of just XMLRead. That way, ReadXMLFile has an additional parameter:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  TXMLReaderFlag = (    xrfAllowLowerThanInAttributeValue,    xrfAllowSpecialCharsInAttributeValue,    xrfAllowSpecialCharsInComments,    xrfPreserveWhiteSpace    );

Navigation

[0] Message Index

Go to full version