> The attached file (XSSimpleTypeDecl ) gives a picture that we are not
keeping
> any registry either for built-in or User-derived datatypes. An static
array is
> used to keep the references of basic types. For derived types, we will
use that
> array with facets defined which will return an compiled object.
>
> I am seeing good use of memory, but a performance lack (not much).
More information about this design:
1. The registry is not kept in any decl class. All decls are stored in
SchemaGrammar objects. The built-in types belong to the schema namespace,
so we have a SchemaGrammar instance for that namespace to hold all the
built-in types. Use-defined types will be stored in separate grammars
corresponding to their target namespaces.
2. Simple types are treated the same as complex types in many ways: they
share the same symbol space, the same registry, the same base
class/interface XSType.
3. Different DV classes are not real simple types. It's only a field of a
simpleType decl. And a base type of a simple type is not from that array
either.
4. When a string is validated against a simpleType, only the current type
is used. That is, we don't call "validate" on the base type to check
whether the value is valid for the base type.
5. The best part of this design is for cleanness: the code processing
facets is centralized. And it uses less memory. But I don't see why there
is a performance lack. Could you be more specific?
> > - Not throw exception from the constructor of XSSimpleTypeDecl, so that
a
> > simpleType decl will be created even if there if an error.
>
> It is not making much sense to me. Can you be more descriptive?
Consider the following simple type decl:
<simpleType name="abc">
<restriction base="string">
... many valid facets
<length value="a"/>
</restriction>
</simpleType>
In Xerces1, facet validity is checked in the constructor of a
DatatypeValidator. So in the above case, when the constructor see the
invalid value of "length" facet, it will throw an exception. Throwing
exception from a constructor means no object is created, so any further
reference to type "abc" will fail, and the error would be "type abc not
found".
This is definitely not what the user expected: the parser should only
report an error about the wrong value of "length", ignore this facet, and
still create the simpleType using other information.
Is this clear enough?
Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-416) 448-3255
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]