473,385 Members | 2,210 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,385 software developers and data experts.

XMLNodeReader, stupid question ?

I want to loop all nodes of an xml file, because I want to search the
content for a certain search pattern.
I did something like this :
reader = New XmlNodeReader(doc)
While reader.Read()
Select Case reader.NodeType
Case XmlNodeType.Element
Select Case reader.Name
Case "al"
Dim value As String
value = reader.ReadInnerXml
If regex.Match(value).Success Then
Debug.WriteLine(value)
End If
End Select
End Select
End While

But when I found the pattern I want the node itself, because I want to be
able to ask the parent and so on. Is this possible ?
If not what do I have to use ?

I want to create a new xml file with the results.

Kris.
Nov 12 '05 #1
1 2577
Kris Desmadryl wrote:
I want to loop all nodes of an xml file, because I want to search the
content for a certain search pattern.
I did something like this :
reader = New XmlNodeReader(doc)
While reader.Read()
Select Case reader.NodeType
Case XmlNodeType.Element
Select Case reader.Name
Case "al"
Dim value As String
value = reader.ReadInnerXml
If regex.Match(value).Success Then
Debug.WriteLine(value)
End If
End Select
End Select
End While

But when I found the pattern I want the node itself, because I want to be
able to ask the parent and so on. Is this possible ?


Currently there is no way to get current XmlNode out of XmlNodeReader.
There is a suggestion open against .NET 2.0 to support this
functionality. You can help - please vote for that suggestion at
http://lab.msdn.microsoft.com/produc...1-91b58ee65f91

For your task you can use SelectNodes()/SleectSingleNode() methods
instead of XmlNodeReader actually - they provide full-fleged XPath node
matching.
--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com
Nov 12 '05 #2

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

Similar topics

0
by: Brian Rogers | last post by:
To whom it may concern: Can anyone explain this behaviour in serialization and deserialization? I serialize an object using an XML serializer. I de-serialize the object from a StringReader and...
4
by: Andy Neilson | last post by:
I've run across a strange behaviour with XmlSerializer that I'm unable to explain. I came across this while trying to use XmlSerializer to deserialize from a the details of a SoapException. This...
2
by: Lampa Dario | last post by:
Hi, where is this stupid error in this program? When I execute it, i receive a segmentation fault error. #include <stdio.h> int main(int argc, char *argv, char *env) { int i=0; int l=0; int...
5
by: Guoqi Zheng | last post by:
I think I have this kind of problem very often, now it is really making me crazy. VS.NET always want to change my html code. Ok, that is fine as long as Vs.Net can ask my confirmaton first. For...
4
by: David | last post by:
All I have an XML document as illustrated in the extract below. I am trying to use the XmlNodeReader to extract information from the document. What I am having trouble with is when I read the...
4
by: Samuel R. Neff | last post by:
I'm deserializing an XML file. If I pass a Stream to the file directly to the deserializer as follows it works fine: o = (New XmlSerializer( GetType(...
3
by: adhag | last post by:
Hi I am trying to parse through a large file in pieces using the xmlNodeReader. I only need it to be forward only and performance is the key but I am having a problem trying to get all the...
1
by: WalterWalt | last post by:
Below is a part of my xml file returned from a webservice. Instead of converting to a datatable and going through it a record at a time checking if ClientCodeType = "Balloon_Type" and ClientCode =...
10
by: jambalapamba | last post by:
I am trying to skip element in xml document where style attribute is VISIBILITY: hidden or DISPLAY: none. In the following example i want to skip the last two elements but when i...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.