473,320 Members | 1,848 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,320 software developers and data experts.

Iterating through child elements with XmlTextReader?

I got a case where an element may contain a list of unknown elements. I
don't know the name of the children, and it matters which parent they
belong to:

<reference id="ref1">
<e1></e1>
<e2></e2>
...
</reference>

I read the doc with XmlTextReader, so I think I need a way to switch
from there to a more XmlDocument-like reading:

XmlNodeList children = parent.ChildNodes;
foreach (XmlNode child in children)
{
...
}

How do you do that?

Gustaf
Feb 1 '06 #1
2 4409
Take a look at my examples at:

http://weblogs.asp.net/sonukapoor/articles/159790.aspx

Sonu Kapoor [MVP]
---
Posted via www.DotNetSlackers.com
Feb 2 '06 #2
Sonu Kapoor wrote:
Take a look at my examples at:

http://weblogs.asp.net/sonukapoor/articles/159790.aspx


Thank you, but I can't see that you solved my problem there. I don't
want to switch to XmlDocument for the whole processing. XmlTextReader is
fine, but not in the case of iterating through children.

Gustaf
Feb 2 '06 #3

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

Similar topics

4
by: Doug Estep | last post by:
Below is a sample of my XML… <MetaData> <Table name="mytable"> <PrimaryKey name="pk"><Column name="mycolumn"/></PrimaryKey> </Table> </MetaData> <Sequencer> <Table name="mytable">
3
by: Cy Huckaba | last post by:
I have been looking around for a sample on how to read an XSD schema and iterate through the elements to display them. I am working in VB.Net and I have looked at all of the docs on msdn and can...
1
by: Emsi | last post by:
Hello, how can I read values of child nodes with the XmlTextReader? File format: <root> <items> <item> <field1>value1</field1> <field2>value2</field2>
2
by: Michael | last post by:
Hi All, I have something going wrong with the XmlTextReader. I have a function that reads the following XML example. For some reason the code is only getting two of the 3 Values elements. Here is...
2
by: Gerald Aichholzer | last post by:
Hello NG, I have the following XML (simplified) having a variable number of v-elements: <record> <field name="parameter"> <v0>paramname0</v0> <v1>paramname1</v1> <v2>paramname2</v2>
5
by: Alan | last post by:
I was wondering whether it is good programming practice or asking for trouble to modify a vector while iterating through it. That is, I want to do something like the following pseudocode in C++: ...
2
by: GreggaR0und | last post by:
Hello; I'm trying to iterate through the sub nodes of a child node, but I'm getting a compile error on the nested For...Next expression saying it is invalid. Using the below code, the HasChild()...
4
RMWChaos
by: RMWChaos | last post by:
The next episode in the continuing saga of trying to develop a modular, automated DOM create and remove script asks the question, "Where should I put this code?" Alright, here's the story: with a...
0
by: sena87 | last post by:
As the title says, can anyone tell me how to get the number of child nodes for lets say <script> node in the xml below using XmlTextReader? (which should be 2 - row1 and row2 ) ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.