You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by sa...@ca.ibm.com on 2001/09/11 18:08:28 UTC

[Xerces 2] simpleType redesign proposal (was Re: Code for XSDGroupTraverser)

Hi Gopal (and other guys who are interested),

As Elena mentioned, we plan to redesign simpleType (was DatatypeValidator)
in Xerces2 schema. I've spent some time on it. Here is what I've done so
far. Your any comments are welcome.

In Xerces1, similar code of handling facets is copied all over the datatype
classes. So there was lots of redundant code and made it difficult to
maintain.

So the basic idea of the redesign is to separate "facets" from various
datatype classes. A new XSSimpleTypeDecl class will be introduced (to
replace the old DatatypeValidator interface), which handles all facets:
check the validity of the facets and validate strings against the facets.

There will still be many DV classes to do the special handling of each
type. (StringDV, DecimalDV, etc., which all implements the same
TypeValidator interface.)

Other changes include:
- Not throw exception from the constructor of XSSimpleTypeDecl, so that a
simpleType decl will be created even if there if an error.
- The facets passed to XSSimpleTypeDecl are stored in an array instead of a
hashtable. This is supposed to be more efficient.
- XSSimpleType.validate() will return compiled form of the value. For
example, if the type is decimal (or a type derived from decimal), the
validate() method will return a BigDecimal object.

I've attached the current XSSimpleTypeDecl class and TypeValidator
interface. The comment is not enough, but I hope it's self-descriptive.

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

(See attached file: XSSimpleTypeDecl.java)(See attached file:
TypeValidator.java)