Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - =?iso-8859-1?Q?redefine_and_empty_xs:group?= [Thread Next] xsi:type attribute in XMLTo: <xmlschema-dev@--.---> Date: 12/10/2004 11:56:00 AM
Hi ,
I am trying to do a schema validation using Xerces(version 2.2.1).The xml I
have is
<getCustomerID xmlns="http://www.vordel.com/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.vordel.com/
file:///E:/TMobile/samplemessages/new/test/tony/test.xsd"
xsi:type="xsd:string">Error
</getCustomerID>
and the schema I have is
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.vordel.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.vordel.com/">
<xsd:element name="getCustomerID">
<xsd:simpleType>
<xsd:restriction>
<xsd:simpleType>
<xsd:union memberTypes="xsd:string"/>
</xsd:simpleType>
<xsd:enumeration value="JK" />
<xsd:enumeration value="DAVE" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:simpleType name="derived_string">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="JK" />
<xsd:enumeration value="DAVE" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Now what i want my schema to achieve is to restrict the value to either
"DAVE" or "JK".Also note the xsi:type attrbute in the schema.
Even if the value is different I am still able to validate the schema. Is
this the expected beahaviour?
Now if I take away the xsi:type="xsd:string" from the xml.Then it will try
to validate the content and gives me the correct exception.
Now I need to have type attribute as the Web service rquires it.So I want
to build up a schema for the same.
I changed the schema to use <xsd:union memberTypes="tns:derived_string"/>
then it gives me a error
org.xml.sax.SAXParseException: cvc-elt.4.3: Type 'xsd:string' is not validly
derived from the type definition of element 'getCustomerID'.
Can someone help me out.I want to know how does schema validation differ
when there is xsi:type attribute in xml itself.
Thanks,
JK
Jaikrishnan R Pillai
Vordel - XML security and management
http://www.vordel.com
Tel: +353-1-603 1706
Fax: +353-1- 603 1701
- Vordel and Software AG to deliver secure integration solutions
- Vordel CTO writes the book on Web Services security
From noah_mendelsohn@u... Fri Dec 10 14:47:31 2004
Received: from bart.w3.org ([128.30.52.40])
by frink.w3. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
