Menu

Schema-less serializing w/ prefix creates malformed EXI

Get Help
2014-09-19
2014-09-25
  • Andre Vehreschild

    Hi,

    I am evaluating different EXI implementations for a client and have some trouble with EXIP. When serializing a trivial XML-file:

    <trivial xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <anElement type="xsi:date"/> </trivial>

    everything went fine and the output is compatible for deserialisation with OpenEXI and Exificient.
    But when I add just a prefix to the attribute "type" in "anElement" like:

    <anElement xsi:type="xsi:date"/>

    then EXIP can't deserialize its owm exi stream anymore and also the other exi implementations fail.

    I have to preserve prefixes, because the client insists (and his schema, which will be used in a second step, has a lot of namespaces, which you don't want to throw away to preserve the meaning and not substitute with something generated or the uri).

    I have reduced the code size of my benchmarking tool (C++) as far as possible and uploaded it to:

    https://gigamove.rz.rwth-aachen.de/download/id/iavg7ujPr4yKKP

    (filename: EXIBenchmark_small.zip; Available until 26.9.2014; Size: 17.5KB)

    Could you please take a look at it and tell me what I am doing wrong? The files of interest will be exipimplementation.cpp method toEXI() and exipxmlparser.cpp implementing an expat driven xml-parser.

    Best regards,
    Andre

     
  • Rumen Kyusakov

    Rumen Kyusakov - 2014-09-23

    Hi Andre,

    I am quite busy at this moment (writing my thesis) but I appreciate that you put some efforts to reduce the code size for your use case so it is crystal clear what you want to do.

    Attached is a working code that preserves the prefixes and shows how you would encode the simple test case you have. Writing that seemed faster than looking at your code and figuring out what's the problem. The code for xsi:type is not that intuitive as it follows the EXI spec i.e. quite low level.
    You can compile with 'gcc -Iinclude -Ibuild/gcc/pc encodeWithPrefixes.c -Lbin/lib -lexip -o encodeWithPrefixes' assuming you are in the trunk.

    Regards,
    Rumen

     
  • Andre Vehreschild

    Hi Rumen,

    thanks for your help. I fixed my mistakes:

    1. Didn't serialice.qnameData() for attributes, when a qualified name was present.
    2. Mixed up the order of setting parseHeader() and setSchema(). Why is EXIP sensitive, that the schema is set (to NULL) after the header is parsed?

    All the best for your thesis.

    Regards,
    Andre

     
  • Rumen Kyusakov

    Rumen Kyusakov - 2014-09-25

    Hi Andre,

    It should not be sensitive but maybe there is some issue somewhere. In any case the idea of setting setSchema() after parseHeader() is because you might need to choose the schema according to the schemaId field which is filled after parseHeader().

    Thanks!

    Rumen

     

Anonymous
Anonymous

Add attachments
Cancel