com.deltaxml.sync.filters
Class UniDeltaCompress

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by com.deltaxml.sync.filters.UniDeltaCompress
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader

public final class UniDeltaCompress
extends XMLFilterImpl

Converts a full unidelta file into a compressed format.

This involves removing vsets within a tree that are the same as the ancestor and adding invariant attributes (those that are unchanged throughout all versions) back onto their containing start element tag as attributes

Example: The unidelta file

 <root xmlns:dxu="..." dxu:vset="|C|A|B|">
   <dxu:attributes dxu:vset="|C|A|B|">
     <att1 dxu:vset="|C|A|B|">
       <dxu:PCDATA dxu:vset="|C|A|B|">value</dxu:PCDATA>
     </att1>
     <att2 dxu:vset="|C|B|">
       <dxu:PCDATA dxu:vset="|C|">c's value</dxu:PCDATA>
       <dxu:PCDATA dxu:vset="|B|">b's value</dxu:PCDATA>
     </att2>
   </dxu:attributes>
   <child1 dxu:vset="|C|A|B|">
     <grandchild dxu:vset="|B|"/>
   </child1>
   <child dxu:vset="|A|B|"/>
 </root>
 
would be compressed into
 <root xmlns:dxu="..." dxu:vset="|C|A|B|" att1="value">
   <dxu:attributes>
     <att2 dxu:vset="|C|B|">
       <dxu:PCDATA dxu:vset="|C|">c's value</dxu:PCDATA>
       <dxu:PCDATA dxu:vset="|B|">b's value</dxu:PCDATA>
     </att2>
   </dxu:attributes>
   <child1>
     <grandchild dxu:vset="|B|"/>
   </child1>
   <child dxu:vset="|A|B|"/>
 </root>
 

Note: This class has not been designed to be extendable and so has been declared final.

Version:
$Revision: 3348 $
Author:
Tristan Mitchell

Constructor Summary
UniDeltaCompress()
          Creates a new UniDeltaCompress filter
 
Method Summary
 void characters(char[] ch, int start, int length)
          Overrides the default characters method.
 void endElement(String uri, String localName, String qName)
          Overrides the default endElement method.
 void startDocument()
          Overrides the default startDocument method.
 void startElement(String uri, String localName, String qName, Attributes atts)
          Overrides the default startElement method.
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniDeltaCompress

public UniDeltaCompress()
Creates a new UniDeltaCompress filter

Method Detail

startDocument

public void startDocument()
                   throws SAXException
Overrides the default startDocument method.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class XMLFilterImpl
Throws:
SAXException

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Overrides the default startElement method.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class XMLFilterImpl
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Overrides the default endElement method.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class XMLFilterImpl
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Overrides the default characters method.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class XMLFilterImpl
Throws:
SAXException


© 2006-2007 DeltaXML Ltd. All Rights Reserved.