Kohsuke Kawaguchi wrote:
> Paul Sandoz wrote:
>
>>>> The serializing side of things should be quite stable as most code
>>>> is rused. The parsing side may be less so because it is new code. I
>>>> am not sure how best we can test both the parser and serializer. Can
>>>> existing JAXB tests be used with FI?
>>>
>>>
>>> If we have instance documents, I think we can. Is there any "FI
>>> encoder" tool?
>>>
>>
>> Yes. There are two options:
>>
>> 1) Use the UNIX script, fi/FastInfoset/bin/xmltosaxtofi
>>
>> xmltosaxtofi <input> <output>
>> -----------------------------
>> Parses an XML document and transforms it into an equivalent fast infoset
>> document using the FI SAX serializer.
>> The 'input' shall be a XML document file.
>> If the input is ommited then the standard input is used.
>> The 'output' is the resulting fast infoset document file.
>> If the output is ommited then the standard output is used.
>>
>> 2) Use the Java class, com.sun.xml.fastinfoset.tools.XML_SAX_FI:
>>
>> https://fi.dev.java.net/source/browse/fi/FastInfoset/src/com/sun/xml/fastinfoset/tools/XML_SAX_FI.java?rev=1.2&view=auto&content-type=text/vnd.viewcvs-markup
>>
>
>
> I can use this to have all our roundtrip tests exercise the FI route.
>
> But I assume that this tool can't produce the base64 encoded text in FI.
> Or can it look for text that look like base64 and automatically create
> base64 record in the produced document?
>
> Can you think of any other way to test it?
>
Good point, how could i have overlooked this!
Since the JAXB FI serializer is very simple and inherits mostly from the
JAXB StAX serializer we could generate the documents using the FI
StAXDocumentSerializer and the JAXB marshaller. The chance of a bug is
small.
For belts and braces we could test that the infoset parsed from the XML
output and the FI output of JAXB marhsalling are equivalent. I think
this is important anyway in the future when the change the serializer.
This might also show up inconsistencies in the binary data to character
conversion between JAXB and FI.
We have FI tests to do this. The saxtosaxevent script generates an
canonical output based on SAX events:
saxtosaxevent <input> <output>
------------------------------
Parses an XML document or a fast infoset document and outputs a SAX event
XML document containing all the SAX events resulting from the parse.
The 'input' shall be an XML document file or a fast infoset
document
file. If the input is ommited then the standard input is used.
The 'output' is the resulting SAX event XML document file.
If the output is ommited then the standard output is used.
Paul.
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109