Michael Seminaro wrote:
> I used the SAX serializer as in the unit tests and it seems to be
> converting binary data into base64. Is there a way to write out binary
> data into the FI document without any encoding?
>
The serializer should do it, when using the
PrimitiveTypeContentHandler.bytes method.
My guess is the problem may be with the decoding. When decoding you need
to register an instance of the PrimitiveTypeContentHandler with the SAX
parser:
SAXDocumentParser p = new SAXDocumentParser();
FastInfosetDefaultHandler h = new SAXHandler();
p.setContentHandler(h);
p.setLexicalHandler(h);
p.setPrimitiveTypeContentHandler(h);
Otherwise the binary content will be converted to base64 and reported as
via the ContentHandler.characters method.
The class org.jvnet.fastinfoset.sax.FastInfosetDefaultHandler (just
commited some JavaDoc for this!) provides a convient helper class with
all handler interfaces implemented with empty methods.
If i guessed wrong and things are still not working please send me a
snippet of your code.
Paul.
> Thanks, I appreciate the help.
> --
> *Michael Seminaro
> *
> Sun Microsystems, Inc.
> Phone: x53182/+1-703-579-1969
> Email: michael.seminaro_at_sun.com <mailto:michael.seminaro_at_sun.com>
>
>
> On May 24, 2006, at 9:16 AM, Paul Sandoz wrote:
>
>> Hi Michael,
>>
>> Next week i will do the following:
>>
>> - write a blog on this subject, see here [1]; and
>>
>> - write some sample code.
>>
>> In the mean time you could look at the JavaDoc, in particular the SAX
>> serializer/parser and the:
>>
>> org.jvnet.fastinfoset.sax.PrimitiveTypeContentHandler
>>
>> If you are feeling a little braver you could take a look at the
>> AlgorithmTest [2] JUnit test case (see method
>> createBuiltInTestFastInfosetDocument).
>>
>> Paul.
>>
>> [1] http://blogs.sun.com/roller/page/sandoz
>> [2]
>> https://fi.dev.java.net/source/browse/fi/FastInfoset/test/algorithm/AlgorithmTest.java?view=markup
>>
>> Michael Seminaro wrote:
>>
>>> Can you point me to any example code or documentation for this API,
>>> other than the really brief examples that exist on the "how to use:"
>>> page? In particular, I would like to know how to build up an XML
>>> document with binary content, in memory, and have that serialized to
>>> a fast infoset document without performing any character encoding on
>>> the binary data.
>>> Thanks.
>>> --
>>> *Michael Seminaro
>>> *
>>> Sun Microsystems, Inc.
>>> Phone: x53182/+1-703-579-1969
>>> Email: michael.seminaro_at_sun.com <mailto:michael.seminaro_at_sun.com>
>>
>>
>> --
>> | ? + ? = To question
>> ----------------\
>> Paul Sandoz
>> x38109
>> +33-4-76188109
>
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109