Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The ghost of XML
Message
De
13/07/2006 17:17:24
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
XML
Titre:
The ghost of XML
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01136248
Message ID:
01136248
Vues:
52
I have been working this afternoon on trying to resolve an issue I have with XML.

I have something like this:
            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.OuterXml
At the
lcXml = oXmlNode.InnerText
line, if I store lcXml in a file, it gives:
My company name & its affiliated
However, the real data that is in the xml is in fact:
My company name & amp; its affiliated
I just can't understand why oXmlNode.InnerText and oXmlNode.Value return a transformation of its content. This is causing me some problems.

The first one is that if I comment the line
lcXml = oApp.StrTran(lcXml, "&", "& amp;")
cXml does contain in fact:
My company name & amp; its affiliated
But, if the line is uncommented, I end up with:
My company name & its affiliated
because 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?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform