com.oroad.stxx.util
Class MessageFilter

java.lang.Object
  extended bycom.oroad.stxx.util.AbstractSAXFilter
      extended bycom.oroad.stxx.util.MessageFilter
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, XMLConsumer

public class MessageFilter
extends AbstractSAXFilter

This filter uses Perl5 regular expressions to filter out irrelevant application resource elements. The XML pattern:

 <applicationResources>
   <key name="foo">Foo Bar</key>
 </applicationResources>
 
is identified.

Author:
Don Brown

Field Summary
 
Fields inherited from class com.oroad.stxx.util.AbstractSAXFilter
contentHandler, lexicalHandler
 
Constructor Summary
MessageFilter(java.util.List patterns)
          Constructor that compiles the patterns
 
Method Summary
 void characters(char[] c, int start, int len)
          Receive notification of character data.
 void endElement(java.lang.String uri, java.lang.String loc, java.lang.String raw)
          Receive notification of the end of an element.
 void startElement(java.lang.String uri, java.lang.String loc, java.lang.String raw, org.xml.sax.Attributes a)
          Receive notification of the beginning of an element.
 
Methods inherited from class com.oroad.stxx.util.AbstractSAXFilter
comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setContentHandler, setDocumentLocator, setLexicalHandler, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageFilter

public MessageFilter(java.util.List patterns)
Constructor that compiles the patterns

Parameters:
patterns - A list of regular expression strings
Method Detail

startElement

public void startElement(java.lang.String uri,
                         java.lang.String loc,
                         java.lang.String raw,
                         org.xml.sax.Attributes a)
                  throws org.xml.sax.SAXException
Receive notification of the beginning of an element.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class AbstractSAXFilter
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
a - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] c,
                       int start,
                       int len)
                throws org.xml.sax.SAXException
Receive notification of character data.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class AbstractSAXFilter
Parameters:
c - The characters from the XML document.
start - The start position in the array.
len - The number of characters to read from the array.
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String loc,
                       java.lang.String raw)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class AbstractSAXFilter
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
Throws:
org.xml.sax.SAXException