com.simonstl.namespace.attributes
Class AttribNamespaceFilter

java.lang.Object
  |
  +--org.xml.sax.helpers.XMLFilterImpl
        |
        +--com.simonstl.namespace.attributes.AttribNamespaceFilter
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 AttribNamespaceFilter
extends org.xml.sax.helpers.XMLFilterImpl

A filter which forcibly namespace-qualifies unqualified elements according to a set of inclusion or exclusion rules. If no rules are set, all namespaces are forcibly qualified.

Version:
0.01 28 July 2001
Author:
Simon St.Laurent

Constructor Summary
AttribNamespaceFilter()
          An empty constructor that requires the use of setParent before starting I don't think this works.
AttribNamespaceFilter(org.xml.sax.XMLReader parent)
          A constructor that takes the parser which will feed it SAX events
 
Method Summary
 NamespaceRules getRules()
          in case you ever need to get the rules out of NamespaceFilter
 org.xml.sax.Attributes processAttributes(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 void setRules(NamespaceRules newRules)
          sets up the rules, read in from a config file by RulesLoader or otherwise concocted in Java using the NamespaceRules class.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Check at startElement for names which should be qualified.
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
characters, endDocument, endElement, 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
 

Constructor Detail

AttribNamespaceFilter

public AttribNamespaceFilter()
An empty constructor that requires the use of setParent before starting I don't think this works.

AttribNamespaceFilter

public AttribNamespaceFilter(org.xml.sax.XMLReader parent)
A constructor that takes the parser which will feed it SAX events
Method Detail

setRules

public void setRules(NamespaceRules newRules)
sets up the rules, read in from a config file by RulesLoader or otherwise concocted in Java using the NamespaceRules class.
Parameters:
newRules - the set of rules the NamespaceFilter will apply to content

getRules

public NamespaceRules getRules()
in case you ever need to get the rules out of NamespaceFilter

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Check at startElement for names which should be qualified. if the context namespace URI matches a rule, the namespace will be forcibly applied to unqualifed elements.
Overrides:
startElement in class org.xml.sax.helpers.XMLFilterImpl

processAttributes

public org.xml.sax.Attributes processAttributes(java.lang.String uri,
                                                java.lang.String localName,
                                                java.lang.String qName,
                                                org.xml.sax.Attributes atts)