uk.apl.jxc.filter
Class XMLFilter

java.lang.Object
  extended by uk.apl.jxc.filter.XMLFilter

public class XMLFilter
extends java.lang.Object

Filters XML by applying a number of filter criteria. Please note citeria are applied in the order in which they are added. Therefore if an element is omitted prior to being in referenced in the expression of a subsequent critera, the latter criteria will have no effect.

Author:
Andrew Leigh

Constructor Summary
XMLFilter()
          Creates a new XMLFilter.
 
Method Summary
 void addCriteria(java.util.Iterator<XMLFilterCriteria> iterator)
          Clears any previously added criteria and adds any criteria found in the iterator.
 void addCriteria(XMLFilterCriteria criteria)
          Adds a criteria to the filter.
 void addCriteriaFromSavedFilter(java.io.File savedFilter)
          Clears any previously added criteria and adds any criteria found in the saved XML filter file.
 org.w3c.dom.Document apply(org.w3c.dom.Document xmlDocument)
          Applies the filter to an XML Document.
 org.w3c.dom.Document apply(java.io.File xmlFile)
          Applies the filter to an XML File.
 org.w3c.dom.Document apply(java.lang.String xmlString)
          Applies the filter to an XML String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLFilter

public XMLFilter()
Creates a new XMLFilter.

Method Detail

addCriteria

public void addCriteria(XMLFilterCriteria criteria)
Adds a criteria to the filter.

Parameters:
criteria - the criteria to be added

addCriteriaFromSavedFilter

public void addCriteriaFromSavedFilter(java.io.File savedFilter)
                                throws XMLFilterException
Clears any previously added criteria and adds any criteria found in the saved XML filter file.

Parameters:
savedFilter - File containing a saved XML filter definition
Throws:
XMLFilterException - when an exception occurs applying the saved filter

addCriteria

public void addCriteria(java.util.Iterator<XMLFilterCriteria> iterator)
Clears any previously added criteria and adds any criteria found in the iterator.

Parameters:
iterator - the mapping iterator
Throws:
XMLMapperException - when an exception occurs applying the mappings

apply

public org.w3c.dom.Document apply(java.lang.String xmlString)
                           throws XMLFilterException
Applies the filter to an XML String.

Parameters:
xmlString - the String of XML to be filtered
Returns:
the filtered XML Document
Throws:
XMLFilterException - when an exception occurs applying the filter

apply

public org.w3c.dom.Document apply(java.io.File xmlFile)
                           throws XMLFilterException
Applies the filter to an XML File.

Parameters:
xmlFile - the File of XML to be filtered
Returns:
the filtered XML Document
Throws:
XMLFilterException - when an exception occurs applying the filter

apply

public org.w3c.dom.Document apply(org.w3c.dom.Document xmlDocument)
                           throws XMLFilterException
Applies the filter to an XML Document.

Parameters:
xmlDocument - the XML Document to be filtered
Returns:
the filtered XML Document
Throws:
XMLFilterException - when an exception occurs applying the filter


Copyright 2010 Andrew Leigh. All Rights Reserved.