← Prev in month
← Prev in thread
[relax-ng] Binary XML by using RELAX NG
This is just a toy idea I'm playing with.
The idea of "binary XML" has been around for a while. One kind of binary
XML can handle any well-formed XML. There is another kind of binary XML
where the format uses schema information to further compress data.
I saw these schema-guided binary XML formats for DTD and XML Schema,
then I thought RELAX NG is even better framework for schema-guided XML
as well.
The idea is this. If you have a schema
<element name="foo">
<optional>
<attribute name="xyz"/>
</optional>
<oneOrMore>
<element name="bar"><text/></element>
</oneOrMore>
</element>
and an instance
<foo>
<bar>abc</bar>
<bar>def</bar>
</foo>
then you can reproduce the same document from a set of "instructions"
that basically describe which branch of choice you had taken. For
example, the first choice you hit is <optional>, so the first
instruction is "skip". Then the next choice is <zeroOrMore>, so the
instruction is "twice". You can record texts and values as you go.
So the complete instructions to reproduce the binary are:
1. skip (the first <optional>)
2. twice (repeat <oneOrMore> twice.)
3. "abc" (the contents of the <text/> in the first iteration)
4. "def" (the contents of the <text/> in the second iteration)
How is this?
regards,
--
Kohsuke KAWAGUCHI
Sun Microsystems
← Prev in month
← Prev in thread