InnerXML not reading top Node

  • Thread starter Thread starter Bas Jaburg
  • Start date Start date
B

Bas Jaburg

I'm creating a Windows App in C#(Smart Client)that calls a webservice.
The webservice returns this:

<?xml version="1.0" encoding="utf-8" ?>
<table id="klasse" records="4792">
<record locator="1">
<KlaKey>04424</KlaKey>
<KlaOms>(Niet in gids of internet)</KlaOms>
</record>
<record locator="2">
<KlaKey>03487</KlaKey>
<KlaOms>1-polig/wisselschakelaar</KlaOms>
</record>
<record locator="3">

…and so on



I call the webservice like this and want to parse the result using a
xmlDocument:

MyService.MyServiceObject myObject= new
SC.MyService.MyServiceObject();

System.Xml.XmlDocument xmlDoc = new XmlDocument();
string innerXml = myObject.AllData().InnerXml;
xmlDoc.LoadXml(innerXml);


This goes wrong however because appearently the innerXml looks like
this:


<record locator="1">
<KlaKey>04424</KlaKey>
<KlaOms>(Niet in gids of internet)</KlaOms>
</record>
<record locator="2">
<KlaKey>03487</KlaKey>
<KlaOms>1-polig/wisselschakelaar</KlaOms>
</record>
<record locator="3">

…and so on


So, the first node is gone (the highest-parent so to speak).

What am I doing wrong?


Help greatly appreaciated.

Bas
 
So, the first node is gone (the highest-parent so to speak).

What am I doing wrong?

You're using InnerXml instead of OuterXml. InnerXml is basically
"everything inside this node". OuterXml is "this node and everything
inside it".
 
Back
Top