dev@jax-ws.java.net

Re: implementing XMLStreamReaderEx.getPCData

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Thu, 09 Feb 2006 09:19:42 -0800

Paul Sandoz wrote:
> Vivek Pandey wrote:
>> I am trying to implement XMLStreamReaderEx.getPCData() to
>> de-reference the xop refererences by base64 encoding the binary
>> attachments.
>>
>> I am trying to use XMLStreamBuffer for this purpose, following is the
>> code:
>>
>> XMLStreamReader xmlreader =
>> XMLStreamReaderFactory.createXMLStreamReader(is, true);
>> XMLStreamBuffer sb = new XMLStreamBuffer();
>> sb.createFromXMLStreamReader(xmlreader);
>> reader= sb.processUsingStreamReaderBufferProcessor();
>>
>> I use the reader in getPCData(). Would you know whats the best way to
>> transform the underlying xml infoset stream into byte stream while
>> resolving xop reverefences - is the only way out is SAX or something
>> else?
>>
>
> I am missing the bigger picture here so I do not understand why you
> need to buffer the XML attachment part.
>
No it doesnt. I am doing pretty much what you mentioned below -
MtomStreamReader delegates XMLStreamReaderImpl for this purpose. I think
I can just delegate getPCData() call to XMLStreamReader.getText() and if
xop reference then dereference it.
> Can't an MTOM XMLStreamReader impl adapt another XMLStreamReader
> instance (its impl does not matter) and check for XOP elements as it
> reads?
>
> As i understand this can be performed in a streaming fashion (in terms
> of infoset but necessarily in terms of attachment parts).
>
>
yes.
>> Another question - XMLStreamReader.reset() - when should we call this
>> in StreamSOAPDecoder - as the last thing in decode()?
>>
>
> At the start makes more logical sense to me, but either the start or
> end would do. Because we have to make sure we work with other XML StAX
> implementations we have to use the reflected method and defer to the
> factory if not our implementation, like in the old code.
>
ok.

-vivek.
> Also we need to make this work with FI, but we can work this out after.
>
> Paul.
>

-- 
Vivek Pandey
Web Services Standards and Technologies
Sun Microsystems Inc.