473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Basiic XML - How to Access some of the XML elements?

I am attempting to learn the XmlReader and need to know how to access
some of the elements. Based on the xml below, how can I read and
display the tags:
"<cd>"
"<genre"
"SKU"
" xmlns"
"<artist>"
The microsoft doc is not too helpful on this and I can not find a good
example on the net. However, If you can point me to better doc. a
good example, etc. I would be appreciative.

Thanks
P.S. My basic code is:

XmlTextReader tr = new
XmlTextReader(@"d:\xml001.xml");
while (tr.Read())
{
Console.WriteLine("X TYPE {0} \t{1} \t{2}
",tr.NodeType, tr.AttributeCount , tr.Value );

}
tr.Close();

<?xml version="1.0"?>
<cd>
<genre SKU="3224554" xmlns="Rock and Roll">
<artist>Crystal Method</artist>
<title>Crash Vegas</title>
</genre>
</cd>
Nov 15 '05 #1
0 881

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

Similar topics

3
by: Thomas Baier | last post by:
Hi there, I'v got a little program generating coincidental lists. It crashes with memory access failure, but not always at the same time. If I start the programm using valgrind it always...
1
by: Will | last post by:
Hi, I have a problem trying to validate dynamically created html form elements using javascript. I have dynamically created a check box using ASP for each record in a recordset and have given each...
63
by: Jerome | last post by:
Hi, I'm a bit confused ... when would I rather write an database application using MS Access and Visual Basic and when (and why) would I rather write it using Visual Studio .Net? Is it as easy...
11
by: Jon Hoowes | last post by:
Hi, I have inherited some code that has some form elements (radio buttons) that are called "1", "2" etc. for example: <input name="2" type="radio" value="45"> <input name="2" type="radio"...
2
by: Chris | last post by:
I'd like to be able to access the elements in an XSD/XmlSchema object to determine things like the datatype. Can this be done without explicitly running validation on a document? Can I...
11
by: Mr. Smith | last post by:
Hello all, My code can successfully open, write to, format and save several worksheets in a workbook then save it by a given name, close and quit excel. My problem is that if I try and do it...
11
by: shankwheat | last post by:
I have a function which passes text from txtdebt to debtsbox which works fine. However, I want to add code which examines the value of debtsbox and if any of the values the user entered contain the...
0
by: thecoolone | last post by:
I am creating a REST API in php that parses the XML result given by IBM Omnifind. here's the php code: $query=$_GET;...
5
by: Paul Brettschneider | last post by:
Hello, I have a global static array of structs and want to access a given element using an identifier. I don't want to use the element subscript, because it will change if I insert elements...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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...

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.