Error reading special character '{' hexadecimal value 0x7B in xml

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am storing the encrypted password in xml file which I have saved in unicode format. While I try to read the xml file and create a dataset from it, it shows me the following error

System.Xml.XmlException: The '{' character, hexadecimal value 0x7B, cannot begin with a name.
The xml tag that I want to read is below:

<DSNNAME>, ($»<{Å `Ê®A]]'Ã</DSNNAME>

I will be very much thakful If someone writes about the solution for this problem.

Regards,
Pushpendra
 
Try surrounding your data with the XML CDATA tag:
<DSNNAME><![CDATA[, ($»<{Å `Ê®A]]'Ã[[></DSNNAME>

Shan Plourde
 
Hi Pushpendra
My bad, my [[> syntax was wrong, true you need to use ]], not [[.

One interesting thing that I noticed was in your error line #'s:

With the invalid CDATA syntax, the error is at line 81, position 1.

With the valid CDATA syntax, the error reported by the XML parser is at
line 43. Maybe that's a clue to help you solve the issue...
Hi Shan,
I have tried your suggession but it's not working
I have tried surroinding the data with CDATA as:
<DSNNAME><![CDATA[, ($»<{Å `Ê®A]]'Ã[[></DSNNAME>
It shows:

System.Xml.XmlException: An unexpected end of file parsing CDATA has occurred. Line 81, position 1.
at System.Xml.XmlScanner.ScanCData()
at System.Xml.XmlScanner.ScanMarkup()
at System.Xml.XmlTextReader.ParseTag()
at System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities()
at System.Xml.XmlTextReader.Read()

If I use CDATA in following Format:

<DSNNAME><![CDATA[, ($»<{Å `Ê®A]]'Ã]]></DSNNAME>

Then it shows me the following error:

System.Xml.XmlException: The '{' character, hexadecimal value 0x7B, cannot begin with a name. Line 43, position 20.
at System.Xml.XmlScanner.ScanName()
at System.Xml.XmlScanner.ScanMarkup()
at System.Xml.XmlScanner.ScanToken(Int32 expected)
at System.Xml.XmlTextReader.SetElementValues()
at System.Xml.XmlTextReader.ParseElement()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlReader.GetTextContent()
at System.Xml.XmlReader.ReadString()


Any other suggession, I should try?? Please write.

Pushpendra









:


Try surrounding your data with the XML CDATA tag:
<DSNNAME><![CDATA[, ($»<{Å `Ê®A]]'Ã[[></DSNNAME>

Shan Plourde

Pushpendra wrote:


I am storing the encrypted password in xml file which I have saved in unicode format. While I try to read the xml file and create a dataset from it, it shows me the following error

System.Xml.XmlException: The '{' character, hexadecimal value 0x7B, cannot begin with a name.
The xml tag that I want to read is below:

<DSNNAME>, ($»<{Å `Ê®A]]'Ã</DSNNAME>

I will be very much thakful If someone writes about the solution for this problem.

Regards,
Pushpendra
 
Back
Top