Visual Basic.NET
  Home arrow Visual Basic.NET arrow Reading and Transforming XML Documents usi...
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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 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? 
VISUAL BASIC.NET

Reading and Transforming XML Documents using Visual Basic 2005
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 17
    2006-11-21

    Table of Contents:
  • Reading and Transforming XML Documents using Visual Basic 2005
  • Reading the tags in an XML document using XMLReader
  • Reading the values (or text) of XML tags in an XML document using XMLReader
  • Reading an XML string using XMLReader
  • Transforming an XML document to HTML using XSLT with VB 2005
  • Transformation using XSLT for multiple XML nodes of the same criteria

  • 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
     
     
    ADVERTISEMENT


    Reading and Transforming XML Documents using Visual Basic 2005


    (Page 1 of 6 )

    This article mainly focuses on reading XML documents in several ways using Visual Basic.NET 2005. Topics discussed include the XMLReader and XSLT, among others.
    A downloadable zip file is available for this article.

    This article mainly focuses on reading XML documents in several ways using Visual Basic.NET 2005.

    If you are new to designing XML Schemas, I suggest you to refer my following articles:

    http://www.devarticles.com/c/a/XML/Designing-Your-own-XML-Schema-Learn-the-
    Essentials/

    http://www.devarticles.com/c/a/XML/Designing-Your-own-XML-Schema-
    Constraining-with-Restrictions/

    http://www.devarticles.com/c/a/XML/Designing-Your-own-XML-Schema-
    Restrictions-and-User-Defined-Types/

    http://www.devarticles.com/c/a/XML/Designing-Your-Own-XML-Schema-Indicators/

    http://www.devarticles.com/c/a/XML/Introduction-to-Relations-in-XML-Schema/

    http://www.devarticles.com/c/a/XML/OneOne-OneMany-and-ManyMany-Relations-
    in-XML-Schema/

    The entire source code for this article is available in the form of a downloadable zip file. The solution was developed using Microsoft Visual Studio 2005 Professional Edition on Microsoft Windows Server 2003 Enterprise Edition together. I didn’t really test the solution with any other/previous editions. If you have any problems in executing the solution, please post in the discussion area.

    XML Schema and XML document

    An XML document is simply a text file with some hierarchical and structural user-defined tags (like HTML tags) containing user-provided data. The syntax, grammar, rules, structure, hierarchy, constraints etc. of a particular XML document is defined using XML Schema (which is also an XML document, but with the XSD extension).

    To work with this article, I worked with the following XML document (Employee.xml):

    <?xml version="1.0" encoding="utf-8"?>

    <Employees xmlns="http://tempuri.org/Employee.xsd">

          <Employee>

                <Empno>1001</Empno>

                <Ename>Jagadish</Ename>

                <Sal>3400</Sal>

                <Deptno>20</Deptno>

          </Employee>

          <Employee>

                <Empno>1002</Empno>

                <Ename>Chatarji</Ename>

                <Sal>4500</Sal>

                <Deptno>10</Deptno>

          </Employee>

          <Employee>

                <Empno>1003</Empno>

                <Ename>Winner</Ename>

                <Sal>3700</Sal>

                <Deptno>10</Deptno>

          </Employee>

          <Employee>

                <Empno>1004</Empno>

                <Ename>Dhanam</Ename>

                <Sal>4300</Sal>

                <Deptno>20</Deptno>

          </Employee>

    </Employees>

    The XML Schema for the above XML document is defined as follows:

    <?xml version="1.0" encoding="utf-8"?>

    <xs:schema id="Employee" targetNamespace=
    "http://tempuri.org/Employee.xsd" elementFormDefault=
    "qualified" xmlns="http://tempuri.org/Employee.xsd" 
    xmlns:mstns="http://tempuri.org/Employee.xsd" xmlns:xs=
    "http://www.w3.org/2001/XMLSchema">

          <xs:element name="Employees">

                <xs:complexType>

                      <xs:sequence>

                            <xs:element name="Employee" maxOccurs="unbounded">

                                  <xs:complexType>

                                        <xs:sequence>

                                              <xs:element name="Empno" type="xs:string"/>

                                              <xs:element name="Ename" type="xs:string"/>

                                              <xs:element name="Sal" type="xs:int"/>

                                              <xs:element name="Deptno" type="xs:int"/>

                                        </xs:sequence>

                                  </xs:complexType>

                            </xs:element>

                      </xs:sequence>

                </xs:complexType>

          </xs:element>

    </xs:schema>

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


       · Hello guys! this is the article which helps you to parse through XML documents using...
       · Great article! Using this as a base, you could distill it down to three...
     

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek