Dim lcXml As String = "" Dim loNodeType As XmlNodeType = Nothing ' Get all child nodes For Each oXmlNode In toChildNodes loNodeType = oXmlNode.NodeType ' If this is a value If loNodeType = XmlNodeType.Text Then lcXml = oXmlNode.InnerText lcXml = oApp.StrTran(lcXml, "&", "& amp;") oXmlNode.InnerText = lcXml End If Next cXML = oXmlDocument.OuterXmlAt the
lcXml = oXmlNode.InnerTextline, if I store lcXml in a file, it gives:
My company name & its affiliatedHowever, the real data that is in the xml is in fact:
My company name & amp; its affiliatedI just can't understand why oXmlNode.InnerText and oXmlNode.Value return a transformation of its content. This is causing me some problems.
lcXml = oApp.StrTran(lcXml, "&", "& amp;")cXml does contain in fact:
My company name & amp; its affiliatedBut, if the line is uncommented, I end up with:
My company name & its affiliatedbecause even if oXmlNode.InnerText and oXmlNode.Value do no expose the encoded characters, they are still present in the content. What is the proper way to achieve a proper conversion here?