info.magnolia.importexport.filters
Class SkipNodePropertyFilter

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by info.magnolia.importexport.filters.SkipNodePropertyFilter
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader
Direct Known Subclasses:
UselessNameFilter

public abstract class SkipNodePropertyFilter
extends org.xml.sax.helpers.XMLFilterImpl

A base abstract filter that can be sub-classed in order to easily implement removal of properties based on their name/content.

Version:
$Revision: 41137 $ ($Author: gjoseph $)
Author:
fgiust

Nested Class Summary
static class SkipNodePropertyFilter.BufferedElement
          Temporary element storage node.
 
Field Summary
protected  boolean invalue
           
protected  String lastNodeName
           
protected  org.slf4j.Logger log
          Logger.
protected  boolean skipProperty
           
 
Constructor Summary
SkipNodePropertyFilter(XMLReader parent)
          Instantiates a new filter.
 
Method Summary
 void characters(char[] ch, int start, int length)
          
 void endElement(String uri, String localName, String qName)
          
protected abstract  boolean filter(String propertyValue, String parentNodeName)
          Implement this method to specificy if a given property (given its value and the parent node name) should be removed.
protected abstract  String getFilteredPropertyName()
          Implement this method to specify the name of the property you want to filter.
 void startElement(String uri, String localName, String qName, Attributes atts)
          
 
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, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.slf4j.Logger log
Logger.


lastNodeName

protected String lastNodeName

skipProperty

protected boolean skipProperty

invalue

protected boolean invalue
Constructor Detail

SkipNodePropertyFilter

public SkipNodePropertyFilter(XMLReader parent)
Instantiates a new filter.

Parameters:
parent - wrapped XMLReader
Method Detail

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.XMLFilterImpl
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException

Specified by:
characters in interface ContentHandler
Overrides:
characters in class org.xml.sax.helpers.XMLFilterImpl
Throws:
SAXException

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.XMLFilterImpl
Throws:
SAXException

getFilteredPropertyName

protected abstract String getFilteredPropertyName()
Implement this method to specify the name of the property you want to filter.

Returns:
filtered property name

filter

protected abstract boolean filter(String propertyValue,
                                  String parentNodeName)
Implement this method to specificy if a given property (given its value and the parent node name) should be removed.

Parameters:
propertyValue - property value
parentNodeName - parent node name
Returns:
true if this property should be removed


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.