XML Reader

  • Thread starter Thread starter MDB
  • Start date Start date
M

MDB

Hello all, I am having problems reading XML and keep getting this error:

{"This is an unexpected token. The expected token is 'NAME'. Line 1,
position 21." }

Can anyone help? Here is the XML and the code I am using. I get the error
at the ds.read line.



xml = said:



XmlTextReader reader = new XmlTextReader(new StringReader(sMessage));

System.Data.DataSet ds = new DataSet();

ds.ReadXml(reader);
 
You have a few problems in the xml: remove all comas, the CONNECT closing
tag is missing.
This one worked for me:

<?xml version="1.0" encoding="utf-8" ?>
- <BODY>
<CONNECT Confirmation="YES" Listen="YES" Service="Messaging"
NetworkService="myservice" Host="myHost" />
</BODY>
 
That did it! Thank you for your help.

Alex Yakhnin said:
You have a few problems in the xml: remove all comas, the CONNECT closing
tag is missing.
This one worked for me:

<?xml version="1.0" encoding="utf-8" ?>
- <BODY>
<CONNECT Confirmation="YES" Listen="YES" Service="Messaging"
NetworkService="myservice" Host="myHost" />
</BODY>
 
Back
Top