[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

  • From: Rick JELLIFFE <ricko@g...>
  • To: xml-dev@l...
  • Date: Mon, 03 Apr 2000 20:38:28 +0800

xml short
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@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.