|
#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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
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 |