Attempting to read XML string and getting error...

B

Bryan Dickerson

I'm still struggling with this XML stuff. I've gotten this far:

oSR = New System.IO.StringReader(oC.GetAllContacts(txCICust.Text,
txCIType.Text))
oXML.LoadXml(oSR.ReadToEnd)
sStr = "Found Contact Name:
".Concat(oXML.DocumentElement.SelectNodes("/Table/CI_NAME").Item(0).Value())

.... but I get an error on the LoadXml method that says: "Root element is
missing." What does that mean?
 
J

Joseph Bittman MCAD

June 17, 2005

Is oXML an XMLDocument? Could you maybe give a little bit of the
starting xml returned from oC? Probably what is happening, is you are
getting data such as

<data>...</...>
<data>...</...>
<data>...</...>

and to load it into a XMLDocument, there needs to be a higher up node such
as:

<group>
<data>...</...>
<data>...</...>
<data>...</...>
</group>

You add your own node to the beginning and end so that it is well formed if
this is the case. A sample would greatly help here! :) Hope this helps and
have a great day!

--
Joseph Bittman
Microsoft Certified Application Developer

Web Site: http://71.35.110.42
Dynamic IP -- Check here for future changes
 
B

Bryan Dickerson

Yes, oXML is an XMLDocument and here is a bit of the XML:

<NewDataSet><Table><CI_NAME>BRYAN
DICKERSON</CI_NAME><CI_TITLE>PROGRAMMER</CI_TITLE>

.... </Table>

.... </NewDataSet>

Joseph Bittman MCAD said:
June 17, 2005

Is oXML an XMLDocument? Could you maybe give a little bit of the
starting xml returned from oC? Probably what is happening, is you are
getting data such as

<data>...</...>
<data>...</...>
<data>...</...>

and to load it into a XMLDocument, there needs to be a higher up node such
as:

<group>
<data>...</...>
<data>...</...>
<data>...</...>
</group>

You add your own node to the beginning and end so that it is well formed
if this is the case. A sample would greatly help here! :) Hope this helps
and have a great day!

--
Joseph Bittman
Microsoft Certified Application Developer

Web Site: http://71.35.110.42
Dynamic IP -- Check here for future changes
 
B

Bryan Dickerson

I tried using a Dataset but couldn't figure that one out either. Where do I
start??
 
C

Chad Z. Hower aka Kudzu

Bryan Dickerson said:
I tried using a Dataset but couldn't figure that one out either.
Where do I start??

Load the XML file in the VS editor. Right click and create schema.

Note: This does not work well with all XML documents, but for those it works with it makes working
with them a lot easier.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

"Well-formed XML" 3

Top