Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 5 - 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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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 / 7
    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

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    Generating XML Schema Dynamically Using VB.NET 2005: Working With Attributes - Generate XML Schema attributes dynamically using the .NET framework: explanation


    (Page 5 of 5 )

    This section explains the code fragment listed in the previous section.  Let us examine it part by part.  I am excluding some of the parts which are already explained in previous articles (and even above). 

    From the following code, you can observe that I removed the sequence particle related to the “Employee” element. It is just maintaining its own complex type:

            Dim eEmployee As New XmlSchemaElement()
            sqOrganization.Items.Add(eEmployee)
            eEmployee.Name = "Employee"
            eEmployee.MaxOccursString = "unbounded"
            Dim ctEmployee As New XmlSchemaComplexType()

            eEmployee.SchemaType = ctEmployee

    We add the attribute “ID” to the “Employee” element as follows:

            Dim eID As New XmlSchemaAttribute()
            ctEmployee.Attributes.Add(eID)
            eID.Name = "ID"
            eID.Use = XmlSchemaUse.Required
            eID.SchemaTypeName = New XmlQualifiedName("int",
    "http://www.w3.org/2001/XMLSchema")

    You should also observe that attributes are to be added to a complex type and never to a sequence type.  According to the above code fragment, we create a new XML schema attribute (“eID”) and add it to the list of attributes related to the complex type of “Employee” element (second statement in the above code).  I wanted to make sure that “ID” is a compulsory attribute for every “Employee” element (which is enforced in the fourth statement).  Similarly, I even defined “Name” and “Age” (but observe that “Age” is not enforced with “XmlSchemaUse.Required”).

    We shall focus on “restrictions” in the up coming articles.  So, stay tuned by signing up the newsletter.  Any comments, suggestions, feedback, bugs, errors, enhancements are highly appreciated at jag_chat@yahoo.com


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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

    VISUAL BASIC.NET ARTICLES

    - Movement and Player Statistics in a VB.NET T...
    - Creating and Drawing a Game Map in VB.NET
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...




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