Hilbert II - Version 0.03.09

org.qedeq.kernel.xml.tracker
Class XPathLocationParser

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.qedeq.kernel.xml.parser.SimpleHandler
          extended byorg.qedeq.kernel.xml.tracker.XPathLocationParser
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class XPathLocationParser
extends SimpleHandler

Parser for XML files. Search simple XPath within an XML file. Usage:

      final XPathLocationParser parser = new XPathLocationParser(xpath);
      parser.parse(xmlFile, original);
      return parser.getFind();

 

Version:
$Revision: 1.23 $

Constructor Summary
XPathLocationParser(String xpath)
          Constructor.
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endDocument()
           
 void endElement(String namespaceURI, String localName, String qName)
           
 void endPrefixMapping(String prefix)
           
 SimpleXPath getFind()
          Get searched XPath.
static SimpleXPath getXPathLocation(File xmlFile, SimpleXPath xpath, URL original)
          Search simple XPath within an XML file.
static SimpleXPath getXPathLocation(File xmlFile, String xpath, URL original)
          Search simple XPath within an XML file.
 void ignorableWhitespace(char[] ch, int start, int length)
           
 void parse(File file, URL original)
          Parses XML file.
 void parse(String fileName, URL original)
          Parses XML file.
 void processingInstruction(String target, String data)
           
 void skippedEntity(String name)
           
 void startDocument()
           
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
           
 void startPrefixMapping(String prefix, String uri)
           
 
Methods inherited from class org.qedeq.kernel.xml.parser.SimpleHandler
getEncoding, getLocator, setDocumentLocator
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathLocationParser

public XPathLocationParser(String xpath)
                    throws ParserConfigurationException,
                           SAXException
Constructor.

Parameters:
xpath - XML file path.
Throws:
ParserConfigurationException - Severe parser configuration problem.
SAXException
Method Detail

getXPathLocation

public static final SimpleXPath getXPathLocation(File xmlFile,
                                                 String xpath,
                                                 URL original)
                                          throws ParserConfigurationException,
                                                 SAXException,
                                                 IOException
Search simple XPath within an XML file.

Parameters:
xmlFile - Search this file.
xpath - Search for this simple XPath.
original - Original file location.
Returns:
Source position information.
Throws:
ParserConfigurationException
SAXException
IOException

getXPathLocation

public static final SimpleXPath getXPathLocation(File xmlFile,
                                                 SimpleXPath xpath,
                                                 URL original)
                                          throws ParserConfigurationException,
                                                 SAXException,
                                                 IOException
Search simple XPath within an XML file.

Parameters:
xmlFile - Search this file.
xpath - Search for this simple XPath.
original - Original file location.
Returns:
Source position information.
Throws:
ParserConfigurationException
SAXException
IOException

parse

public final void parse(String fileName,
                        URL original)
                 throws SAXException,
                        IOException
Parses XML file.

Parameters:
fileName - Parse this input.
original - Original file location.
Throws:
SAXException - Syntactical or semantical problem occurred.
IOException - Technical problem occurred.

parse

public final void parse(File file,
                        URL original)
                 throws SAXException,
                        IOException
Parses XML file.

Parameters:
file - Parse this input.
original - Original file location.
Throws:
SAXException - Syntactical or semantical problem occurred.
IOException - Technical problem occurred.

endDocument

public void endDocument()
                 throws SAXException
Throws:
SAXException

startDocument

public void startDocument()
                   throws SAXException
Throws:
SAXException

characters

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

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Throws:
SAXException

getFind

public SimpleXPath getFind()
Get searched XPath. Hopefully the start and end location are set.

Returns:
Searched XPath.

Hilbert II - Version 0.03.09

©left GNU General Public Licence
All Rights Reserved.