Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Certifications
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Product and Other Certifications
problem in applying unique constraint on xml attribute through xsd unique
ganesh b pol
Greenhorn
Posts: 14
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
my xsd file is
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="mq_systems"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" ref="mq_system"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="mq_system"> <xs:complexType> <xs:attribute name="id" use="required" type="xs:string" /> <xs:attribute name="type" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="ibm"/> <xs:enumeration value="active_mq"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="ip" type="xs:string"/> <xs:attribute name="port"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="9999"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="user_name" type="xs:string"/> <xs:attribute name="password" type="xs:string"/> <xs:attribute name="mq_manager_name" type="xs:string"/> <xs:attribute name="channel_name" type="xs:string"/> <xs:attribute name="queue_name" type="xs:string"/> <xs:unique name="unique_mq_sys_name"> <xs:selector xpath="mq_system"/> <xs:field xpath="@id"/> </xs:unique> </xs:complexType> </xs:element> </xs:schema>
i want id attribute of mq_system must be unique
i.e. for following xml file
<?xml version="1.0" encoding="UTF-8"?> <mq_systems xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='file:/D:/projects/messaging/messaging/src/config/mq/mq_send_message_systems.xsd'> <mq_system id="a1" type="ibm" ip="10.16.21.167" port="9000" user_name="abc" password="pass"/> <mq_system id="a1" type="ibm" ip="10.16.21.167" port="9000" user_name="abc" password="pass"/> <mq_system id="a1" type="active_mq" ip="10.16.21.167" port="9000" user_name="abc" password="pass"/> </mq_systems>
must not be valid since its id attribute contains duplicate element how should i achive this with xsd.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
unble to validate xml against schema
Axis 1.4 throwing org.xml.sax.SAXException: Invalid element
problem in applying restriction on xml attribute jaxb i.e. unable to do validation for attributes
schema generation
XML valiadation using schema
More...