Visual Basic.NET
  Home arrow Visual Basic.NET arrow Generating Restrictions in XML Schema Dyna...
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 
 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 Restrictions in XML Schema Dynamically Using VB.NET 2005: Preliminaries
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2006-03-15

    Table of Contents:
  • Generating Restrictions in XML Schema Dynamically Using VB.NET 2005: Preliminaries
  • Restrictions (or constraints) in XML Schema: VB.NET sample
  • Restrictions (or constraints) in XML Schema: explanation
  • Extending the previous restriction with minExclusive
  • Differences between xxxExclusive and xxxInclusive

  • 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

    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!

    Generating Restrictions in XML Schema Dynamically Using VB.NET 2005: Preliminaries
    (Page 1 of 5 )

    This is the first article in a series concentrating on generating restrictions in XML Schema dynamically using Visual Basic 2005. The series is mainly targeted at those who are familiar with XML, XML Schema and the .NET framework.
    A downloadable file for this article is available here.

    If you are new to XML, there exist several articles on XML alone on this web site (try “igrep”).  If you are new to XML Schema, I strongly suggest you go through my series “Designing your own XML Schema.”  If you are new to generating XML Schema using .NET, I suggest you go through my series “Generating XML schema dynamically using VB.NET 2005.”

    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 this link: http://go.microsoft.com/fwlink/?linkid=14202.  Please  note that some of the examples in this series may not be practical.  Those were designed only for explaining the particular concept.

    Restrictions (or constraints) in XML Schema: A sample schema

    Since I already covered “restrictions” in my series “designing your own XML schema,” I will not repeat the information.  Here we shall work directly with a sample scenario.

    I would like to have an element “AGE” present in my XML Schema.  I can assign a data type “integer” to it.  But this is not sufficient because I would like to have a value between 0 and 100 (whereas an integer would accept more than that).  This means a “restriction” is necessary.  Let us consider the following XML Schema, which can do something better:

    <?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">
                    <xs:simpleType>
                      <xs:restriction base="xs:integer">
                        <xs:maxInclusive value="100" />
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="ID" type="xs:int"
    use="required" />
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>

    Let us concentrate on the “age” element.  It stays under the “Employee” element.  Its “simpleType” (or data type) is defined as an integer type.  And finally, we applied the “restriction” by specifying the maximum value as follows:

    <xs:element name="age">
          <xs:simpleType>
                <xs:restriction base="xs:integer">
                      <xs:maxInclusive value="100" />
                </xs:restriction>
          </xs:simpleType>
    </xs: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.”  You can use “Exclusive” or “Inclusive” according to your requirements (they can even be interchanged).  But care should be taken while defining the same (especially when using tools).

    Now let us go through an example with .NET!

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


       · Hi, now you can work with restrictions in XML Schema using VB 2005. Any feedback is...
     

    VISUAL BASIC.NET ARTICLES

    - 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...
    - Programmatically Controlling Windows Fax Ser...
    - Focusing on Forms and Menus in Visual Basic
    - Manipulating Forms with the Windows Forms Li...
    - Basics of the Windows Forms Library
    - Forms, Controls, and Other Useful Objects
    - Implementing OOP to Develop Database Oriente...
    - Using Themes and Skins for Personalization w...
    - A Deeper Look at Personalization using Visua...

     
    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 2 hosted by Hostway