Visual Basic.NET
  Home arrow Visual Basic.NET arrow Generating XML Schema Dynamically Using VB...
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

Generating XML Schema Dynamically Using VB.NET 2005: Working With Attributes
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 15
    2006-02-20

    Table of Contents:
  • Generating XML Schema Dynamically Using VB.NET 2005: Working With Attributes
  • Generate XML Schema attributes dynamically using .NET framework: source code
  • Generate XML Schema attributes dynamically using .NET framework: explanation
  • Generate more XML Schema attributes dynamically using .NET framework: a sample schema and XML
  • Generate XML Schema attributes dynamically using the .NET framework: explanation

  • 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


    Generating XML Schema Dynamically Using VB.NET 2005: Working With Attributes


    (Page 1 of 5 )

    This is the third article in a series concentrating on generating XML Schema dynamically using Visual Basic 2005.
    A downloadable file for this article is available here.

    The entire solution for this article was developed using Visual Studio 2005 Professional Edition on Windows Server 2003 standard edition.  Some examples in this series may not compile successfully using Visual Studio 2003, as some of the features in .NET 1.1 turned out to be obsolete in .NET 2.0.  For complete details you can refer to the link http://go.microsoft.com/fwlink/?linkid=14202.  Please note that some of the examples in this series may not be practical.  They have been designed only for explaining the concept.

    Generate XML Schema attributes dynamically using .NET framework: A sample schema

    As I covered all the basics in my previous articles, we shall now focus on more practical “complex types” in XML Schema, supported with attributes as well.  Let us consider the following XML Schema:

    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="Organization">
        <xs:complexType>
          <xs:sequence>
            <xs:element maxOccurs="unbounded" name="Employee">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Name" type="xs:string" />
                  <xs:element name="Age" type="xs:int" />
                </xs:sequence>
                <xs:attribute name="ID" type="xs:int"
    use="required" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

    According to the above example, the document root element would be “Organization.”  The element “Organization” internally can contain “Employee” elements.  The element “Employee” internally contains two more elements, “Name” and “Age”.  You should observe that there can be any number of “Employee” elements within the “Organization” element. 

    You should also observe that “Name” and “Age” are defined with “simple types” rather than with “complex types.”  The only complex elements are “Organization” and “Employee.”  The most important declaration within the above schema is as follows:

    <xs:attribute name="ID" type="xs:int" use="required" />

    The above statement makes sure that every “Employee” element is provided with the attribute “ID” (which is of type “int”).  To generate the above XML Schema dynamically, we can consider the complete code listed in the next section.

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


       · Another article contributed for the series. Have it and enjoy. Any doubts (or...
     

    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 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek