net.sf.fikin.sql.core
Class SimpleXmlFile.SimpleSAXParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by net.sf.fikin.sql.core.SimpleXmlFile.SimpleSAXParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Direct Known Subclasses:
MultipleXmlFiles.FileUrlParser
Enclosing class:
SimpleXmlFile

public class SimpleXmlFile.SimpleSAXParser
extends org.xml.sax.helpers.DefaultHandler

recognizes only SimpleXmlFile.getTag() tag and extract its characters if any nested tags would cause SAXException created on Dec 17, 2006

Since:
Version:
$Revision: 1.6 $
Author:
fiykov

Constructor Summary
SimpleXmlFile.SimpleSAXParser()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          collect all tag's data
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          wait for the tag to end
protected  void execute(java.lang.String uri, java.lang.String localName, java.lang.String qName, java.lang.String cmd)
          execute the given command via SQLPipeElement.execute(String)
protected  java.lang.String getValue(java.lang.String uri, java.lang.String localName, org.xml.sax.Attributes attr)
          lookup the attributes for given attribute and return its value
protected  boolean matchTag(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          match the even for a recognized tag
protected  void setLogFile(java.lang.String file, java.lang.Class cls)
          set log file of a generic AbstractOutput class
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
          wait for the tag to appear
protected  boolean toBoolean(java.lang.String flg)
          convert "true" or "false" strings to boolean case insensitive comparison
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, 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

SimpleXmlFile.SimpleSAXParser

public SimpleXmlFile.SimpleSAXParser()
Method Detail

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
wait for the tag to appear

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
wait for the tag to end

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
collect all tag's data

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

matchTag

protected boolean matchTag(java.lang.String uri,
                           java.lang.String localName,
                           java.lang.String qName)
match the even for a recognized tag


execute

protected void execute(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName,
                       java.lang.String cmd)
                throws java.sql.SQLException,
                       org.xml.sax.SAXException
execute the given command via SQLPipeElement.execute(String)

Parameters:
cmd -
Throws:
java.sql.SQLException
org.xml.sax.SAXException

getValue

protected java.lang.String getValue(java.lang.String uri,
                                    java.lang.String localName,
                                    org.xml.sax.Attributes attr)
lookup the attributes for given attribute and return its value

Parameters:
uri -
localName -
attr -
Returns:
attribute's value or null if not found

setLogFile

protected void setLogFile(java.lang.String file,
                          java.lang.Class cls)
                   throws org.xml.sax.SAXException
set log file of a generic AbstractOutput class

Parameters:
file -
cls -
Throws:
java.io.FileNotFoundException
org.xml.sax.SAXException

toBoolean

protected boolean toBoolean(java.lang.String flg)
convert "true" or "false" strings to boolean case insensitive comparison

Parameters:
flg -
Returns:
true for "true", otherwise false


Copyright © 2003-2007 Nikolay Fiykov. All Rights Reserved.