Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Methods for Parsing XML files

By Jon Winer, (first published: 2002/06/20)

Methods for Parsing XML files
     As we all know, in coding, there are many ways to get the same job done. In my experimentation with XML, I have run across many instances where this scenario is clearly true. Although some methods are grossly better than others, they all have a place in our programming repertoire depending on the circumstance. Take a look at some examples.

This example uses the selectSingleNode method to access the value of each node.
This example uses the getElementsByTagName method to create a node list for each node name group. Then parses the xml file by iterating through each node list.
This example uses the getElementsByTagName method to create a 'parent' node list, then accesses each child node based on its index.
This example uses the getElementsByTagName method to create a 'parent' node list, then iterates through its child nodes and returns the node value and name.

For additional articles, please feel free to visit my homepage. Have questions, email me at
Total article views: 15316 | Views in the last 30 days: 3
Related Articles

CLR Table-Valued Function Example with Full Streaming (STVF / TVF)

SQL CLR Table-Valued Functions can stream data back, but there aren't many examples of the quick and...


Triggers Examples

Triggers Examples


Optimizer Join Methods

Understanding the different types of joins used by the optimizer will help developers and DBAs under...


Example SCD type 2

Example SCD type 2


Exploring Recursive CTEs by Example

Recursive CTEs can be confusing and scary, so examining some non-standard examples may cast light up...


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones