Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > XML

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-23-2009, 10:31 AM
Hari7 Hari7 is offline
Registered User
 
Join Date: Oct 2009
Posts: 1
Linking attribute value

Hi All,

I have a Xml document and a Xml Schema document. In xml Schema i have define sum type which i am using to validate XMl Document.

I want to link the attribute value with one another.

As per the below code i want Regionid and regionType should be linked with each other.

For example : In XMl document it should only allow RegionID="ER" and reion="Europe and Russia"

it should not allow other values with reionID="ER" and vice versa.


below is the Code of XMl Schema :


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="User" minOccurs="0" maxOccurs="6">
<xs:complexType>
<xs:attribute name="region" use="required" type="regiontype"/>
<xs:attribute name="regionId" use="required" type="regionIdtype"/>
</xs:complexType>
</xs:element>
</xs:schema>


<xs:simpleType name="regiontype">
<xs:restriction base="xs:NMTOKENS">
<xs:enumeration value="Europe and Russia"/>
<xs:enumeration value="North America"/>
<xs:enumeration value="Latin and South America"/>
<xs:enumeration value="Africa"/>
<xs:enumeration value="Middle East"/>
<xs:enumeration value="Far East and Australsia"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="regionIdtype">
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="ER"/>
<xs:enumeration value="NA"/>
<xs:enumeration value="LSA"/>
<xs:enumeration value="AF"/>
<xs:enumeration value="ME"/>
<xs:enumeration value="FEA"/>
</xs:restriction>
</xs:simpleType>


XMl Structure :
===============
<?xml version="1.0" encoding="UTF-8"?>
<User regionId="ER" region="Europe and Russia">

</User>

How can i achieve this.

Thanks

-Hari
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Restricting the Attribute value in XML Schema john2078 XML 0 10-20-2009 10:45 AM
Set userPassword attribute in ADAM using LDAP+JNDI rcgram Java 1 02-06-2008 10:18 AM
In XML, I can define a tag as either Attribute or Element, which better? mycwcgr XML 1 10-31-2005 02:57 PM
Need to find and then replace Attribute values Chris XML 1 04-26-2001 04:20 AM
support for namespaces on attribute value Noga Atsil XML 1 11-21-2000 01:04 PM


All times are GMT -4. The time now is 12:05 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.