ASP.NET Code
  Home arrow ASP.NET Code arrow Page 2 - How to Load XML Documents in ASP.NET 2.0
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM Rational Software Development Conference
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET CODE

How to Load XML Documents in ASP.NET 2.0
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 12
    2007-02-20

    Table of Contents:
  • How to Load XML Documents in ASP.NET 2.0
  • Loading an XMLDocument
  • Load (string) where string is an XML file
  • Load (System.IO.Stream) method

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    How to Load XML Documents in ASP.NET 2.0 - Loading an XMLDocument
    (Page 2 of 4 )

    The five different Load() methods shown in the above picture surrounded by a red rectangle will be explored with code to show how each of them may be used to load the XMLDocument. The various methods are used in a web site project, XMLSite. The XMLDocument gets instantiated and loaded in the click event of a button. All of the examples use the same XML file which has been used in other XML related tutorials by the author on the DevArticles.com and ASPFree.com web sites.

    LoadXml (string) method

    After instantiating an XMLDocument using the New keyword you can invoke the LoadXml() method with the XML file in a string format as an argument as shown in the following picture. Also observe that the argument to the method typed in is an XML file content in a string format.

    Once the XML document is loaded you can invoke its properties through the XML DOM Model to verify if the content is loaded correctly. This may be simply tested as shown by the completed code and the output written as a Response.Write() as shown.

    Response.Write(xmldoc.HasChildNodes)
    Response.Write("<br/>")
    Response.Write(xmldoc.DocumentElement.LastChild.InnerXml)
    Response.Write("<br/>")

    The result of running the above in the IE browser is as shown in the next picture.

    More ASP.NET Code Articles
    More By Jayaram Krishnaswamy


       · XMLDocument class a full service class to address all needs of an XML document....
     

    ASP.NET CODE ARTICLES

    - How to Use the ListBox Control in ASP.NET 2.0
    - How to Load XML Documents in ASP.NET 2.0
    - DataGrid Code
    - ASP.NET Guestbook
    - User Controls and Client Side Scripting
    - ASP.NET Programming with Microsoft's AS...
    - ASP.NET Basics (part 3): Hard Choices
    - ASP.NET Basics (part 2): Not My Type
    - ASP.NET Basics (part 1): Nothing But .Net
    - Directory Tree Browser
    - How to get the confirmation of Yes/No from a...
    - Complete example using custom errors and wri...
    - Paging Certain # records per page .NET style
    - General Methods of formatting and Subtractin...
    - .NET LinkButton web control

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway