dev@fi.java.net

Re: SAX interfaces for encoding algorithms and restricted alphabets

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 27 Jan 2005 10:34:15 +0100

Santiago Pericas-Geertsen wrote:
>
> On Jan 26, 2005, at 6:55 PM, Paul Sandoz wrote:
>
>> Santiago Pericas-Geertsen wrote:
>>
>>> On Jan 26, 2005, at 4:46 PM, Paul Sandoz wrote:
>>>
>>>> The PrimitiveTypeContentHandler and
>>>> RestrictedCharacterContentHandler are desgined to be abstracted from
>>>> the details of Fast Infoset and provide support for the built-in
>>>> encoding algorithms and restricted alphabets.
>>>
>>> In RestrictedCharacterContentHandler, don't you want to report the
>>> data as byte[] for the built-in restricted alphabets.
>>
>>
>> It is meant to return data as char[], the idea is the method just
>> identifies the set of restricted characters. This may be useful for
>> XSD validators or binders. However it this feature is not set the
>> parser can just return these characters as normal character events.
>
>
> If they are reported to RestrictedCharacterContentHandler, I don't
> think they should be reported as char[] as this doubles the memory
> requirements for the buffer. In some environments, this may be an issue.
> IMO it is better to report them as byte[] and perhaps offer some utility
> method to convert byte[] to char[], but leave this decision to the app.
>

The SAX parser needs to keep a char buffer around anyway for strings
(identifing and non-identifying) so this buffer can be reused in this case.

This interface is mirroring the PrimitiveTypeContentHandler interface in
that artifacts are returned in the corresponding primitive type in Java
to be of immediate use.

But you make a good point, IMHO it seems the best place to use byte[]
would be for the more generic AlphabetAndAlgorithmContentHandler.
Clients wishing to avail of their own optimizations in processing can
use the AlphabetAndAlgorithmContentHandler which always returns bytes.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_fi.dev.java.net
For additional commands, e-mail: dev-help_at_fi.dev.java.net