You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by sa...@ca.ibm.com on 2001/04/09 23:37:12 UTC

Changes to Datatype in Schema PR

Hi all,

Thanks to Elena's help, (part of) the datatype changes from Schema CR to
Schema PR are merged into CVS. Any alpha-testing, comments, or suggestion
are appreciated.

Here are the main changes (I use base.facet to indicate the facet defined
in the base type from which the current datatype is derived):

1. Name change:
1) URIReference -> anyURI
2) binary -> hexBinary/base64Binary
3) CDATA -> nomalizedString

2. Lexical space change:
1) boolean: add "0" and "1"

3. Facet change:
1) no "encoding" facet for binary types
2) no bounds facets "max/min In/Ex clusive" for
QName/NOTATION/ID/IDREF/ENTITY

4. Facet name change:
1) scale -> fractionDigits
2) precision -> totalDigits

5. Facet constrain change:
1) new: length == base.length (in fact, the spec says length <=
base.length, but should change in the near future)
2) new: minLength >= base.minLength
3) new: maxLength <= base.maxLength
4) new: error: whiteSpace = replace/preserve && base.whiteSpace = collapse
5) new: error: whiteSpace = preserve && base.whiteSpace = replace
6) new: maxInclusive vs. base.(all bounds)
7) new: maxExclusive vs. base.(all bounds)
8) new: minInclusive vs. base.(all bounds)
9) new: minExclusive vs. base.(all bounds)
10) new: minInclusive < maxExclusive
11) new: minExclusive < maxInclusive
12) new: totalDigits <= base.totalDigits

If you think there is anything wrong or missing from the above list, please
let me know.

Two known problems are:
1. 'fixed' is not supported
2. 'ID' and 'IDREF' are not properly checked.

Thanks,
Sandy Gao
Software Developer, IBM Canada
(1-416) 448-3255
sandygao@ca.ibm.com



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


validate schema

Posted by Cheezca <ch...@yahoo.com>.
hi,

I'm implementing DOMParser to validate a document with schema.
However, it reports no error even if i change the doc/schema.

I've set the feature (validation, dynamic validation, schema, and
namespaces), installed the errorHandler and used setErrorHandler.

Is there anything that I missed that might be the problem?

Thanks.





__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: Changes to Datatype in Schema PR

Posted by Kohsuke KAWAGUCHI <k-...@bigfoot.com>.
I think org.apache.xerces.validators.datatype.QNameDatatypeValidator has
a problem.

It seems to me (from a casual look at the source code) that enumeration
facet of QName is handled based on lexical space, rather than its value
space.

Therefore

<simpleType name="foo">
  <restriction base="QName">
    <enumeration value="abc:def" xmlns:abc="uri:abc1" />
  </restriction>
</simpleType>

This foo type accepts the following text

<test  xmlns:abc="uri:abc2">       abc:def    </test>

which is actually invalid.

I believe the current implementation also accepts the following, too:

<test>  abc:def  </test>



It looks like a trivial problem, but in fact it's no easy to fix this
bug. To handle enumeration of QName correctly, facets have to be passed
to validator with a "context" (in this case, a map of declared
namespaces). Even worse, each enumeration item has to be accompanied
with its own context.

The interface of DatatypeValidator has to be modified, which probably results
in broader changes.


regards,
----------------------
K.Kawaguchi
E-Mail: k-kawa@bigfoot.com


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: Changes to Datatype in Schema PR

Posted by Kohsuke KAWAGUCHI <k-...@bigfoot.com>.
I don't want to offend anybody, but it seems to me that a completely
different design may be worth consideration to better serve the current
datatype spec.

I understand that org.apache.xerces.validators.datatype is designed to
meet the requirements of early draft of XML Schema datatypes, where
distinction between lexical constraint and value constraint was not
clear.

Look at James Clark's implementation. There are a lot to learn.


regards,
----------------------
K.Kawaguchi
E-Mail: k-kawa@bigfoot.com


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: Changes to Datatype in Schema PR

Posted by Elena Litani <li...@ca.ibm.com>.
> I think org.apache.xerces.validators.datatype.QNameDatatypeValidator has
> a problem.
Yes, it does. :( 

> It seems to me (from a casual look at the source code) that enumeration
> facet of QName is handled based on lexical space, rather than its value
> space.
Yep, you are right. We had this problem for other datatypes as well..
For some we fixed it, for some we did not.
 
> The interface of DatatypeValidator has to be modified, which probably results
> in broader changes.
Hopefully, we won't need to change the design. 

We will try to fix this problem in the next release.
Is there anyway you can help us with that? :)

Thank you for letting us know about this bug. 
Elena

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: Changes to Datatype in Schema PR

Posted by Kohsuke KAWAGUCHI <ko...@eng.sun.com>.
I think org.apache.xerces.validators.datatype.QNameDatatypeValidator has
a problem.

It seems to me (from a casual look at the source code) that enumeration
facet of QName is handled based on lexical space, rather than its value
space.

Therefore

<simpleType name="foo">
  <restriction base="QName">
    <enumeration value="abc:def" xmlns:abc="uri:abc1" />
  </restriction>
</simpleType>

This foo type accepts the following text

<test  xmlns:abc="uri:abc2">       abc:def    </test>

which is actually invalid.

I believe the current implementation also accepts the following, too:

<test>  abc:def  </test>



It looks like a trivial problem, but in fact it's no easy to fix this
bug. To handle enumeration of QName correctly, facets have to be passed
to validator with a "context" (in this case, a map of declared
namespaces). Even worse, each enumeration item has to be accompanied
with its own context.

The interface of DatatypeValidator has to be modified, which probably results
in broader changes.



----
Kohsuke KAWAGUCHI
Phone: 650-786-0721


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org