473,326 Members | 2,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

[XML Schema] Invalid constraint value ambiguity

This is an issue I've got using the Xerces-J 2.7.1 release when loading
the following schema:

<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="sample-elem" type="MyInteger" default="0" />
<xs:simpleType name="MyInteger">
<xs:restriction base="xs:decimal">
<xs:pattern value="[\-+]?[0-9]+" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

Xerces gives me an error:

e-props-correct.2: Invalid value constraint value '0' in element
'sample-elem'.

I've tried the XML Schema Validator on the W3C site and it gave me no
error.

So I've initially posted on the Xerces-J Users list [1] and I was
pointed the default value should be also valid to the canonical lexical
representation of the datatype [2], where "0" have to be "0.0"
(according to the canonical lexical representation of the 'decimal'
type), but then it is not valid to the pattern specified, so schema as
the given one is effectively invalid.

Now as far as I understand the spec, the default value should be valid
according to the canonical lexical representation of the "MyInteger"
type and not the 'decimal' one, but then how is the canonical lexical
representation of user defined types determined, is it specified at
all?

[1] "[XML Schema] Invalid constraint value error (bug?)"
<http://mail-archives.apache.org/mod_mbox/xerces-j-users/200601.mbox/browser>

[2] http://www.w3.org/TR/xmlschema-1/#e-props-correct

Jan 5 '06 #1
1 2154
Stanimir Stamenkov wrote:
Now as far as I understand the spec, the default value should be valid
according to the canonical lexical representation of the "MyInteger"
type and not the 'decimal' one, but then how is the canonical lexical
representation of user defined types determined, is it specified at
all?

[1] "[XML Schema] Invalid constraint value error (bug?)"
<http://mail-archives.apache.org/mod_mbox/xerces-j-users/200601.mbox/browser>


Seems I've already got a definitive answer from Sandy Gao on the
Xercec-J Users list, that it looks like hole in the spec. Still I would
welcome any additional comments, thank you.

--
Stanimir

Jan 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sony Antony | last post by:
Hello: ( Please redirect me to the correct list if this is not where I m supposed to ask this question ) Our application essentially sends xml 'commands' to another system. These commands...
2
by: Olaf Meyer | last post by:
Apprentently xerces 2.6.0 (Java) does not validate against contraints specified in the schema (e.g. constraints specified via unique element). The validation works with the XML editor I'm using...
0
by: Olaf Meyer | last post by:
I'm wondering if I can also express uniquness constraints on attributes of objects that I have referenced from somewhere else. To be a bit more precise here a short and simple XML document. The...
3
by: Victor | last post by:
Hi, I have some sample XML and an XSD below I have written. The XSD almost does what I want. What I need is some way of enforcing that AT LEAST TWO of the attributes "TestAttribute" are "X". ...
6
by: bosgoverde | last post by:
I've tried several ways to achieve a xsd schema for the following xml example, but failed to do so. Valid: <Person> <Interest>Movies</Interest> <Interest>Computers</Interest> </Person>...
1
by: Craig Beuker | last post by:
Hello, I am experimenting with this XmlValidatingReader and have a question about how it is working (or not working as would be the case) The sample documents and code are included at the end...
2
by: Frosty | last post by:
Howto make datagrid enforce rules of xml schema? Created xml schema in the designer. Constraints created there using the following <xs:simpleType name="zipcode"><xs:restriction...
0
by: Olivier Ishacian | last post by:
XMLmind XML Editor V3.0 Patch 1 can be downloaded from http://www.xmlmind.com/xmleditor/download.shtml _____________________________________________ V3.0 Patch 1 (December 2, 2005) ...
1
by: Nichino | last post by:
Hello, I'm trying to define my first Xml Schema and have a problem. The XML I'd like to define through the Schema is the following one. Can you help me please? I don't know how to insert the 3...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.