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

XML parsing in C#

I have a XML file like as follow

<?xml version="1.0" encoding="UTF-8"?>
<NeuStarLSRReport>
<NeuStarHeader fromDate="09/10/04" toDate="09/13/04"
RequestsReceived ="43" ResponsesSent="50">
</NeuStarHeader>
<NeuStarReqestList>
<NeuStarRequestRecieved pon="IDT2345611" ver="AA"
dateReceived="09/10/04" />
<NeuStarRequestRecieved pon="IDT2345615" ver="AA"
dateReceived="09/10/04" />
</NeuStarReqestList>
<NeuStarResponseList>
<NeuStarResponseSent pon="IDT2345611" ver="AA"
dateSent="09/10/04" MessageType="Error"/>
<NeuStarResponseSent pon="IDT2345622" ver="AB"
dateSent="09/10/04" MessageType="Error"/>
</NeuStarResponseList>
</NeuStarLSRReport>
from the above XML i need to parse the nodes inside node
<NeuStarRequestList>
<NueStarResponseList> node. Both these nodes can have 1 or more number
of child nodes as described below( in above example, its just 2 for
each of them, but they can more or less also)'
how do i part the attributes values and i need to store them in the
database. For each node in both the nodes(NeuStarRequestList and
NeuStarResponseList) i need to insert a row into database table
conatining appropriate fields

any help?

venky
Nov 12 '05 #1
1 6121
Well you can do the following (just one way of doing it, I'm sure there are
lots other)

1. First find the node that you want to process, you can simply do an this
XPath '//NeuStarLSRReport/NeuStarReqestList/NeuStarRequestRecieved '. This
will give you the XmlNodeCollection that you want to process.

2. Loop through that collection for each node that you want to process. For
each node you can get the attributes list (using the .Attributes property).
And then for each attributes you can build your SQL string

3. Do step 1 and 2 for the NeuStarResponseList nodes.

"Venkat Chellam" wrote:
I have a XML file like as follow

<?xml version="1.0" encoding="UTF-8"?>
<NeuStarLSRReport>
<NeuStarHeader fromDate="09/10/04" toDate="09/13/04"
RequestsReceived ="43" ResponsesSent="50">
</NeuStarHeader>
<NeuStarReqestList>
<NeuStarRequestRecieved pon="IDT2345611" ver="AA"
dateReceived="09/10/04" />
<NeuStarRequestRecieved pon="IDT2345615" ver="AA"
dateReceived="09/10/04" />
</NeuStarReqestList>
<NeuStarResponseList>
<NeuStarResponseSent pon="IDT2345611" ver="AA"
dateSent="09/10/04" MessageType="Error"/>
<NeuStarResponseSent pon="IDT2345622" ver="AB"
dateSent="09/10/04" MessageType="Error"/>
</NeuStarResponseList>
</NeuStarLSRReport>
from the above XML i need to parse the nodes inside node
<NeuStarRequestList>
<NueStarResponseList> node. Both these nodes can have 1 or more number
of child nodes as described below( in above example, its just 2 for
each of them, but they can more or less also)'
how do i part the attributes values and i need to store them in the
database. For each node in both the nodes(NeuStarRequestList and
NeuStarResponseList) i need to insert a row into database table
conatining appropriate fields

any help?

venky

Nov 12 '05 #2

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

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home...
16
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed...
0
by: Pentti | last post by:
Can anyone help to understand why re-parsing occurs on a remote database (using database links), even though we are using a prepared statement on the local database: Scenario: ======== We...
9
by: ankitdesai | last post by:
I would like to parse a couple of tables within an individual player's SHTML page. For example, I would like to get the "Actual Pitching Statistics" and the "Translated Pitching Statistics"...
5
by: randy | last post by:
Can some point me to a good example of parsing XML using C# 2.0? Thanks
3
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
7
by: Daniel Fetchinson | last post by:
Many times a more user friendly date format is convenient than the pure date and time. For example for a date that is yesterday I would like to see "yesterday" instead of the date itself. And for...
1
by: eyeore | last post by:
Hello everyone my String reverse code works but my professor wants me to use pop top push or Stack code and parsing code could you please teach me how to make this code work with pop top push or...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.