Aleksander Slominski wrote:
> i was thinking that it could be accomplished with adding new XNI 
> feature such as buffer-reuse and set it to false (?!) 

It could be something like:

  http://apache.org/xml/features/internal/entity-scanner/reuse-buffer

with the default being "true".

> however i am not still how all those
> 
>    System.arraycopy(fCurrentEntity.ch, offset,tmp, 0, length);
> 
> will be affected...

That would be easy.

The reason why we have those array copies is for the case when
an element or attribute name (for example) crosses a buffer 
boundary. So we use a little trick to copy the first few chars
we've seen to the front of the original array (which we don't
need anymore) and then do a re-load at the offset.

Now, if we wanted to ensure that the buffers were not re-used,
we would simply add a hook method and call it before every
attempt to re-use a buffer. For example, in the case you 
pointed out, where we try to copy the first few chars to the
beginning of the buffer.

I haven't worked out the exact code but I would add a hook
method like "nextBuffer" that would either return the existing
buffer or a new one, depending on the state of the parser
feature that the application can set. Then this method would
be called throughout the code at all points where we try to
re-use the buffer.

-- 
Andy Clark * IBM, TRL - Japan * [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to