472,807 Members | 3,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

searching element of xml file for blocks of text

I need to search an xml element for blocks of text. The start of the text
block will have a 5 digit number in it and i then need to read until the
next 5 digit number. After this, I need to put them in different containers
of their own. Where would I start?

Oct 6 '08 #1
3 1776
On Oct 6, 12:32*pm, "Andy B" <a_bo...@sbcglobal.netwrote:
I need to search an xml element for blocks of text. The start of the text
block will have a 5 digit number in it and i then need to read until the
next 5 digit number. After this, I need to put them in different containers
of their own. Where would I start?
Look up the following (with regards to .NET) on MSDN, after you learn
a bit you should be able to do what you need.

Xml
XPath
Regex

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Oct 6 '08 #2
Andy B wrote:
I need to search an xml element for blocks of text. The start of the text
block will have a 5 digit number in it and i then need to read until the
next 5 digit number. After this, I need to put them in different containers
of their own. Where would I start?
To find the text contents of the XML element itself you can use
XmlReader or XPathDocument/XPathNavigator or XmlDocument or (with .NET
3.5) LINQ to XML. Then to parse that block of text it sounds as if
regular expressions could help e.g.
\d{5}.*?\d{5}
is a regular expression matching five digits, anything else and five digits.
If you want to manipulate the XML (not sure whether "put them in
different containers" relates to XML) then XmlDocument or LINQ to XML
are the right APIs.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Oct 6 '08 #3
Putting it in containers means that I need to get the text blocks. When I
find them I need to put part of it in a textbox and part of it in a
listview/listbox. Here is an example of the text blocks I need to parse.

'following line goes inside a listbox/listview
99999 A description of the item in question

'following steps go inside a textbox
1. step 1
2. step 2
3. step 3

and the steps list continues until another 5 digit number is found. This is
the parsing detail that I need for right now.
"Martin Honnen" <ma*******@yahoo.dewrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Andy B wrote:
>I need to search an xml element for blocks of text. The start of the text
block will have a 5 digit number in it and i then need to read until the
next 5 digit number. After this, I need to put them in different
containers of their own. Where would I start?

To find the text contents of the XML element itself you can use XmlReader
or XPathDocument/XPathNavigator or XmlDocument or (with .NET 3.5) LINQ to
XML. Then to parse that block of text it sounds as if regular expressions
could help e.g.
\d{5}.*?\d{5}
is a regular expression matching five digits, anything else and five
digits.
If you want to manipulate the XML (not sure whether "put them in different
containers" relates to XML) then XmlDocument or LINQ to XML are the right
APIs.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Oct 7 '08 #4

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

Similar topics

3
by: sal achhala | last post by:
I'm working with java and XML documents in order to search for keywords in a given element name, eg element name 'author' == "jo blogs". The problem is the XML documents are downloaded (this...
3
by: abs | last post by:
Hi all. I use such code to clone blocks: element = document.getElementById(IdOfElement) element = element.cloneNode(true) new_element = document.getElementById(IdOfElement).appendChild(element)...
0
by: Ben Engbers | last post by:
Hi, This is the first time I use SAX in order to translate my XML and I encountered the following problem. I use the following Java-code to produce xml that should be transformed (Based on...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
17
by: J.S. | last post by:
I have a text file with parameters like the following embedded in the text: @@TextBox1@@, @@TextBox2@@, etc. I know how to read this text file. However, I am trying to figure out how to...
7
by: pbd22 | last post by:
Hi. I am somewhat new to this and would like some advice. I want to search my xml file using "keyword" search and return results based on "proximity matching" - in other words, since the search...
3
by: Ahmad Jalil Qarshi | last post by:
Hi, I have a text file having size about 2 GB. The text file format is like: Numeric valueAlphaNumeric values Numeric valueAlphaNumeric values Numeric valueAlphaNumeric values For example...
5
by: dm3281 | last post by:
Hello, I have a text report from a mainframe that I need to parse. The report has about a 2580 byte header that contains binary information (garbage for the most part); although there are a...
12
by: Alexnb | last post by:
This is similar to my last post, but a little different. Here is what I would like to do. Lets say I have a text file. The contents look like this, only there is A LOT of the same thing. () A...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.