OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   C code for XML short-tagging ( was ZML and binary XML)

[ Lists Home | Date Index | Thread Index ]
  • From: Rick JELLIFFE <ricko@geotempo.com>
  • To: xml-dev@lists.oasis-open.org
  • Date: Mon, 03 Apr 2000 20:38:28 +0800

For anyone who has a requirement to store or transmit XML in a less
verbose format, but for whom binary compression is not an appropriate
solution, you may be interested in short-tag compression as an
inexpensive run-time option.

I wrote some code for this a couple of years ago to test the interaction
of short-tagging and compression.  It is available as two little C
utilities:
	http://www.ascc.net/~ricko/src/short-tag-compress.c
	http://www.ascc.net/~ricko/src/short-tag-uncompress.c
They are pure preprocessors and don't require knowledge of a DTD.

A short-tagged XML file is no longer XML, but it is still legimate SGML
(change the appropriate parameter on the SGML declaration for XML), and
it is still readable text. The only advantage of short-tagging over
compression is that it may be a little more lightweight to implement
(also, some kinds of compression may interact badly--compressing a text
file into binary may lose some of its advantages if the transmitting
system then recodes binary files as Bin64--this needs more testing). 
The benefits of short-tagging are completely DTD and document-dependent.

To give a contrived example, 

 <schematron:schema
xmlns:schematron="http://www.ascc.net/xml/schematron/1.3">
    <schematron:pattern>
	<schematron:rule context="doggy/smell">
          <schematron:assert test="parent::doggy/nose"
          >A dog should have a nose to smell</schematron:assert>
        </schematron:rule>
        <schematron:annotation xmlns:html="URI for HTML">
           <html:p>My dog has no nose</html:p>
           <html:p>How does he smell?</html:p>
           <html:p>Pretty bad</html:p>
           <html:p>(Boom Boom)</html:p>
        </schematron:annotation>    
    </schematron:pattern>
  </schematron:schema>

would be converted to

 <schematron:schema
xmlns:schematron="http://www.ascc.net/xml/schematron/1.3">
    <schematron:pattern>
	<schematron:rule context="doggy/smell">
          <schematron:assert test="parent::doggy/nose"
          >A dog should have a nose to smell</>
        </>
        <schematron:annotation xmlns:html="URI for HTML">
           <html:p>My dog has no nose</>
           <>How does he smell?</>
           <>Pretty bad</>
           <>(Boom Boom)</>
        </>    
    </>
  </>

This is a perfectly legitimate compression of XML, but if short-tagging
in some form eventually becomes popular, I hope it is as a compression
and not as a dialect of XML.

By the way, the results of shorttagging and compression together were,
from my memory, that shorttagging only resulted in at most 3% gain when
zlib compressed compared to zlib compression alone. Given that this gain
is highly unreliable anyway (since it depends on the DTD and the
instance) I didn't think it was worthwhile to persue this line further.
However, I have seen some papers at conferences where people were very
excited to get a 3% gain, so perhaps it may be useful for someone.

Rick Jelliffe

***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS