Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Xml reader for special character

$
0
0
I have a below xml file.

<?xml version="1.0" encoding="iso-8859-1"?>
<bcreport created="20-Jun-2020 6:28:13 PM">
<filecomparison created="20-Jun-2020 6:28:12 PM">
<filename1>\\PC3\D\test1.bas</filename1>
<filename2>\\PC3\D\test2.bas</filename2>
<linecomp status="same">
<text ltid="1" rtid="1">Attribute VB_Name = "test"</text>
</linecomp>
<linecomp status="same">
<text ltid="2" rtid="2"> If Trim(RRRnum) "" Then RRRnum = RRRnum &amp; "|"</text>
</linecomp>
<linecomp status="same">
<text ltid="3" rtid="3">'to remove special chars like &Amp;-case sensitive</text>
</linecomp>
</filecomparison>
</bcreport>

Here '&amp;' in line "If Trim(RRRnum) "" Then RRRnum = RRRnum &amp;" is the special character.
And '&Amp;' in line "to remove special chars like &amp;-case sensitive" is not a special character.

The code used for reading xml file.
       Dim reader As XmlTextReader = New XmlTextReader("D:\file_1.xml")       reader.EntityHandling = EntityHandling.ExpandEntities        
       Dim xDoc As XmlDocument = New XmlDocument()        
       xDoc.Load(reader)       
       Dim nodeReader As XmlNodeReader = New 
       XmlNodeReader(xDoc)             DtXmlTbl.ReadXml(nodeReader)             nodeReader.Close()

But i will get a error:Reference to undeclared entity 'AMP'.

How to solve this error?

 


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>