How can I get the Open XML DOM parser to parse an ntEntityRef node?

marccos_or

New Member
I have this XML input:\[code\]<?xml version="1.0" encoding="utf-8"?><string><N/A></string>\[/code\]Here is a short code sample to illustrate the problem:\[code\]uses xmldom, oxmldom, XMLDoc, XMLIntf;procedure TForm1.Test;var Document : IXMLDocument; StringNode : IXMLNode; LessThanNode : IXMLNode;begin DefaultDOMVendor := 'Open XML'; Document := LoadXMLData(Memo1.Lines.Text); StringNode := Document.DocumentElement; LessThanNode := StringNode.ChildNodes.First; ShowMessage(LessThanNode.Text); // Displays '' (an emtpy string) ShowMessage(LessThanNode.XML); // Displays '<' ShowMessage(StringNode.Text); // Causes an EXMLDocError, because the string node contains more than just a single node with NodeType = ntTextend;\[/code\]How can I get the \[code\]Open XML\[/code\] parser to transform the \[code\]<\[/code\], \[code\]&gt\[/code\] and similar XML entities to their real text (like \[code\]<\[/code\] and \[code\]>\[/code\])?I could write a workaround for the predefined entities in the XML specification:http://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-entThat won't help with additional entity nodes though ...Related: Why doesn't IXMLNode.IsTextElement return True for CDATA elements?
 
Back
Top