How
to parse XML data in an ASP page?
The Document
Object Model plays an important role in displaying the xml data in an
asp page. This is a standard governed by W3C. You will be using this DOM
for working with the xml documents to display the data in them in an asp
page. to parse the xml data in an asp page, you have to load the xml document
and navigate through the elements.
_______________________________________________
_______________________________________________
For this
you have to first create an XML Document Object using the Server.CreateObject
method. Once you have created this object. Use the async property of the
xml document object to set it to false so that the contents of the xml
file are loaded instantly without any delay. Now it is time to load the
xml file. Load the xml file using the Load method of the xml DOM.
This method
takes the physical path of the xml file as an argument. Since it is not
easy to judge the physical path, we use the Server.MapPath method to get
the physical path and load that document.
Now, the
xml document being loaded, it is time to navigate through the xml documents
and get the elements of the xml document. You have to start from the main
node or the root node and navigate through the document and then display
it.
If you are
using an xsl sheet then you can use the transformNode method to transform
the xml document using the xsl and display it.
FREE
Subscription
Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.
Note
: We never rent, trade, or sell my email lists to
anyone.
We assure that your privacy is respected
and protected.
_______________________________________
Recommended
XML Books
|
|