sk.uniba.euromath.tools.xml.sax
Class AttributeReplacerHandler

java.lang.Object
  extended by sk.uniba.euromath.tools.xml.sax.ContentHandlerDelegate
      extended by sk.uniba.euromath.tools.xml.sax.AttributeReplacerHandler
All Implemented Interfaces:
ContentHandler

public class AttributeReplacerHandler
extends ContentHandlerDelegate

Replaces attributes in all elements, optionally ensuring that each replaced attribute has unique value. Sends all invoked events to given sink.

Author:
Martin Vysny

Field Summary
 QName attrReplace
          Attribute to be replaced.
 QName attrReplaceWith
          The new attribute name.
 boolean unique
          If true then ensure that all replaced attributes have unique value.
 
Fields inherited from class sk.uniba.euromath.tools.xml.sax.ContentHandlerDelegate
sink
 
Constructor Summary
AttributeReplacerHandler(ContentHandler sink, QName attrReplace, QName attrReplaceWith, boolean unique)
          Constructor.
 
Method Summary
 void endDocument()
           
 void startDocument()
           
 void startElement(String uri, String localName, String qName, Attributes atts)
           
 
Methods inherited from class sk.uniba.euromath.tools.xml.sax.ContentHandlerDelegate
characters, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attrReplace

public final QName attrReplace
Attribute to be replaced. Prefix part is ignored.


attrReplaceWith

public final QName attrReplaceWith
The new attribute name. Prefix is required. If null then the replace attribute is removed.


unique

public final boolean unique
If true then ensure that all replaced attributes have unique value.

Constructor Detail

AttributeReplacerHandler

public AttributeReplacerHandler(ContentHandler sink,
                                QName attrReplace,
                                QName attrReplaceWith,
                                boolean unique)
Constructor.

Parameters:
sink - receives all events.
attrReplace - attribute to be replaced. Prefix part is ignored.
attrReplaceWith - the new attribute name. Prefix is required. If null then the replace attribute is removed.
unique - if true then ensure that all replaced attributes have unique value.
Method Detail

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class ContentHandlerDelegate
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class ContentHandlerDelegate
Throws:
SAXException

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class ContentHandlerDelegate
Throws:
SAXException


Copyright 2003-2003-2006 null. All Rights Reserved.