473,466 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

C# and XML Document

I am having problems with the following code. I am able to open the xml
document and read it into memory and if I step through the code and look at
the variables, I can see that the XML document is correct. What is
happening is that what is being returned into TableName is
"System.Xml.XmlElement" If I look at the variables in the autos window, I
can see the following in InnerXML, <FOLDERNAME>Member</FOLDERNAMEetc.
Folders =
Doc.SelectSingleNode("SCHEMA").SelectSingleNode("F OLDER").SelectSingleNode("SUBFOLDERS").ChildNodes;

TableList = new ArrayList();

foreach(XmlNode Folder in Folders)

{

TableName = Folder.SelectSingleNode("FOLDERNAME").ToString();

TableList.Add(TableName);

}

return TableList;

Thanks

Bill


Apr 2 '07 #1
2 1755
Instead of .ToString(), try .InnerText or InnerXML.

"news.microsoft.com" <bi*******@charter.netwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I am having problems with the following code. I am able to open the xml
document and read it into memory and if I step through the code and look at
the variables, I can see that the XML document is correct. What is
happening is that what is being returned into TableName is
"System.Xml.XmlElement" If I look at the variables in the autos window, I
can see the following in InnerXML, <FOLDERNAME>Member</FOLDERNAMEetc.
Folders =
Doc.SelectSingleNode("SCHEMA").SelectSingleNode("F OLDER").SelectSingleNode("SUBFOLDERS").ChildNodes;

TableList = new ArrayList();

foreach(XmlNode Folder in Folders)

{

TableName = Folder.SelectSingleNode("FOLDERNAME").ToString();

TableList.Add(TableName);

}

return TableList;

Thanks

Bill


Apr 2 '07 #2
"news.microsoft.com" <bi*******@charter.netwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I am having problems with the following code. I am able to open the xml
document and read it into memory and if I step through the code and look at
the variables, I can see that the XML document is correct. What is
happening is that what is being returned into TableName is
"System.Xml.XmlElement" If I look at the variables in the autos window, I
can see the following in InnerXML, <FOLDERNAME>Member</FOLDERNAMEetc.
Folders =
Doc.SelectSingleNode("SCHEMA").SelectSingleNode("F OLDER").SelectSingleNode("SUBFOLDERS").ChildNodes;

TableList = new ArrayList();

foreach(XmlNode Folder in Folders)

{

TableName = Folder.SelectSingleNode("FOLDERNAME").ToString();

TableList.Add(TableName);

}

return TableList;
You seem to be assuming that XmlNode.ToString will return the value of the
node. This is clearly not the case.

You want the InnerText property of the XmlNode.

John
Apr 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: techy techno | last post by:
Hii Just wanted to know how can I decorate my texboxes and Listmenu which is called from a JS file using the following code below: document.write("<SELECT NAME='cur2' ONCHANGE='cconv1();'>");...
2
by: Brett Baisley | last post by:
Hello I have a block of html code that I want to run by calling a javascript function to print it. Its basically a table with menu items in it that is the same for many pages, and instead of...
2
by: Edward | last post by:
The below code builds 2 tables 4 rows by 4 cols. All cells have checkboxes. When checked, the checkboxes in the first column automatically check the remainder of the check boxes in the same row. ...
1
by: lawrence | last post by:
This PHP function prints out a bunch of Javascript (as you can see). This is all part of the open source weblog software of PDS (www.publicdomainsoftware.org). We had this javascript stuff...
12
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical...
4
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
8
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
5
by: WilliamRLinden | last post by:
Hi world! we are pretty new to JavaScript and have been struggling for now 2 days on this problem ... We would appreciate mercy if anyone can give us some. Basically we are trying to simulate...
6
by: therig | last post by:
I'm having issues, I've spent many hours searching and I'm a noob at javascript, any help will be greatly appreciated. I keep getting the following error: Error: document.forms.sec11_A has no...
4
by: dr1ft3r | last post by:
Hey guys, I'm building a site for a landscaping business down the street and can't seem to get part of the code functioning correctly. The code fails on line 68 where I make a reference to an...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.