com.aptana.sax
Class AttributeSniffer

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.aptana.sax.AttributeSniffer
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class AttributeSniffer
extends org.xml.sax.helpers.DefaultHandler

Author:
Kevin Sawicki (ksawicki@aptana.com)

Constructor Summary
AttributeSniffer(java.lang.String elementName, java.lang.String attributeName)
          Creates a new attribute sniffer for an element name and attribute name
 
Method Summary
 java.lang.String getMatchedValue()
          Gets the value sniffed
 void read(java.io.InputStream in)
          Load an XML stream and validate it against this reader's schema
 void read(java.lang.String filename)
          Load a xml file and validate it against this reader's schema
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, 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

AttributeSniffer

public AttributeSniffer(java.lang.String elementName,
                        java.lang.String attributeName)
Creates a new attribute sniffer for an element name and attribute name

Parameters:
elementName -
attributeName -
Method Detail

read

public void read(java.lang.String filename)
          throws javax.xml.parsers.ParserConfigurationException,
                 org.xml.sax.SAXException,
                 java.io.IOException
Load a xml file and validate it against this reader's schema

Parameters:
filename - The name of the xml file to load and validate
Throws:
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException

read

public void read(java.io.InputStream in)
          throws javax.xml.parsers.ParserConfigurationException,
                 org.xml.sax.SAXException,
                 java.io.IOException
Load an XML stream and validate it against this reader's schema

Parameters:
in - The input stream that contains XML
Throws:
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException
See Also:
DefaultHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

getMatchedValue

public java.lang.String getMatchedValue()
Gets the value sniffed

Returns:
- matched value