dke.smwp.serialize
Class IncrementalModificationFilter

java.lang.Object
  |
  +--org.xml.sax.helpers.XMLFilterImpl
        |
        +--dke.smwp.serialize.IncrementalModificationFilter
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public class IncrementalModificationFilter
extends org.xml.sax.helpers.XMLFilterImpl

class deriving an XML filter.

This class is designed to sit between an XMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.

Version:
1.0
Author:
Martin Bernauer, Werner Enser

Field Summary
private  int curDepth
           
private static boolean DEBUG
           
private  java.lang.String idAttLocalName
          private cache of id attribute
private  java.lang.String idAttNamespaceURI
          private cache of id attribute
private  java.lang.String idAttValue
          private cache of id attribute
private  boolean inScopeOfModification
           
private  TupleModificationDescr modifyDescr
          type of modificaton on tuple
private  QName parentElt
          private cache of parent element
private  QName tupleElt
          private cache of tuple element
private  int tupleEltInDepth
           
private  java.util.Hashtable xmlTuple
          private cache of tuple in pseudo XML representation
private  QName[] xmlTupleElts
          private cache of tuple in pseudo XML representation
 
Fields inherited from class org.xml.sax.helpers.XMLFilterImpl
contentHandler, dtdHandler, entityResolver, errorHandler, locator, parent
 
Constructor Summary
IncrementalModificationFilter(TupleModificationDescr modifyDescr)
          Construct an empty XML filter, with no parent using TupleModificationDescr.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Filter a character data event if character is in scope of modification.
 void endElement(java.lang.String uri, java.lang.String locName, java.lang.String qualName)
          Filters an end document event limitation: not possible to use multiple child-elements which are using the same element-name
 void setTupleElementInDepth(int d)
          sets element depth in which elements are to be processed
 void startElement(java.lang.String uri, java.lang.String locName, java.lang.String qualName, org.xml.sax.Attributes atts)
          Filters a start element event.
 
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, setupParse, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG

modifyDescr

private TupleModificationDescr modifyDescr
type of modificaton on tuple

tupleElt

private QName tupleElt
private cache of tuple element

parentElt

private QName parentElt
private cache of parent element

idAttNamespaceURI

private java.lang.String idAttNamespaceURI
private cache of id attribute

idAttLocalName

private java.lang.String idAttLocalName
private cache of id attribute

idAttValue

private java.lang.String idAttValue
private cache of id attribute

xmlTuple

private java.util.Hashtable xmlTuple
private cache of tuple in pseudo XML representation

xmlTupleElts

private QName[] xmlTupleElts
private cache of tuple in pseudo XML representation

inScopeOfModification

private boolean inScopeOfModification

tupleEltInDepth

private int tupleEltInDepth

curDepth

private int curDepth
Constructor Detail

IncrementalModificationFilter

public IncrementalModificationFilter(TupleModificationDescr modifyDescr)
Construct an empty XML filter, with no parent using TupleModificationDescr.

This filter will have no parent: you must assign a parent before you start a parse or do any configuration with setFeature or setProperty.

Parameters:
modifyDescr -  
Method Detail

setTupleElementInDepth

public void setTupleElementInDepth(int d)
sets element depth in which elements are to be processed
Parameters:
d - element depth

startElement

public void startElement(java.lang.String uri,
                         java.lang.String locName,
                         java.lang.String qualName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Filters a start element event.
Overrides:
startElement in class org.xml.sax.helpers.XMLFilterImpl
Parameters:
uri - The element's Namespace URI, or the empty string.
locName - The element's local name, or the empty string.
qualName - The element's qualified (prefixed) name, or the empty string.
atts - The element's attributes.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String locName,
                       java.lang.String qualName)
                throws org.xml.sax.SAXException
Filters an end document event

limitation: not possible to use multiple child-elements which are using the same element-name

Overrides:
endElement in class org.xml.sax.helpers.XMLFilterImpl
Parameters:
uri - The element's Namespace URI, or the empty string.
locName - The element's local name, or the empty string.
qualName - The element's qualified (prefixed) name, or the empty string.
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Filter a character data event if character is in scope of modification.
Overrides:
characters in class org.xml.sax.helpers.XMLFilterImpl
Parameters:
ch - An array of characters
start - The starting position in the array.
length - The number of characters to use from the array
Throws:
org.xml.sax.SAXException - The client may throw an exception during processing.