de.pannenleiter.util
Class FragmentParser

java.lang.Object
  |
  +--de.pannenleiter.util.FragmentParser

public class FragmentParser
extends java.lang.Object
implements XmlHandler, org.xml.sax.AttributeList

FragmentParser -- parses a document fragment


Field Summary
protected  int addChilds
           
protected  int addId
           
protected  int addVersion
           
protected  int attrOffset
           
protected  int count
           
protected  java.lang.String currentId
           
protected  java.lang.String currentVersion
           
protected  QueryFilter filter
           
protected  int id
           
protected  java.lang.String idText
           
protected  XmlParser parser
           
protected  int skip
           
protected  org.xml.sax.helpers.AttributeListImpl theAttributeList
           
protected  org.xml.sax.DocumentHandler theDocumentHandler
           
 
Constructor Summary
FragmentParser()
           
 
Method Summary
 void attribute(java.lang.String aname, java.lang.String value, boolean isSpecified)
          Handle an attribute assignment.
 void charData(char[] ch, int start, int length)
          Handle character data.
 void comment(char[] ch, int start, int length)
           
 void doctypeDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Handle a document type declaration.
 void endCDATA()
           
 void endDoctype()
           
 void endDocument()
          Handle the end of the document.
 void endElement(java.lang.String element)
          Handle the end of an element.
 void endExternalEntity(java.lang.String systemId)
          Handle the end of an external entity.
 void error(java.lang.String message, java.lang.String systemId, int line, int column)
          Throw an exception for a fatal error.
 int getLength()
          Return the number of attributes in this list.
 java.lang.String getName(int pos)
          Return the name of an attribute in this list (by position).
 java.lang.String getType(int pos)
          Return the type of an attribute in this list (by position).
 java.lang.String getType(java.lang.String name)
          Return the type of an attribute in this list (by name).
 java.lang.String getValue(int pos)
          Return the value of an attribute in this list (by position).
 java.lang.String getValue(java.lang.String name)
          Return the value of an attribute in this list (by name).
 void ignorableWhitespace(char[] ch, int start, int length)
          Handle ignorable whitespace.
 void parse(org.xml.sax.InputSource source)
           
 void processingInstruction(java.lang.String target, java.lang.String data)
          Handle a processing instruction.
 java.lang.Object resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolve an external entity.
 void setDbid(int id, int version)
           
 void setDocumentHandler(org.xml.sax.DocumentHandler handler)
           
 void setFilter(QueryFilter filter)
           
 void startCDATA()
           
 void startDocument()
          Handle the start of the document.
 void startElement(java.lang.String element)
          Handle the start of an element.
 void startExternalEntity(java.lang.String systemId)
          Handle the start of an external entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theDocumentHandler

protected org.xml.sax.DocumentHandler theDocumentHandler

theAttributeList

protected org.xml.sax.helpers.AttributeListImpl theAttributeList

id

protected int id

idText

protected java.lang.String idText

addId

protected int addId

addVersion

protected int addVersion

addChilds

protected int addChilds

attrOffset

protected int attrOffset

currentId

protected java.lang.String currentId

currentVersion

protected java.lang.String currentVersion

count

protected int count

skip

protected int skip

filter

protected QueryFilter filter

parser

protected XmlParser parser
Constructor Detail

FragmentParser

public FragmentParser()
Method Detail

setDocumentHandler

public void setDocumentHandler(org.xml.sax.DocumentHandler handler)

setDbid

public void setDbid(int id,
                    int version)

setFilter

public void setFilter(QueryFilter filter)

parse

public void parse(org.xml.sax.InputSource source)
           throws org.xml.sax.SAXException,
                  java.io.IOException

getLength

public int getLength()
Return the number of attributes in this list.
Specified by:
getLength in interface org.xml.sax.AttributeList

getName

public java.lang.String getName(int pos)
Return the name of an attribute in this list (by position).
Specified by:
getName in interface org.xml.sax.AttributeList

getType

public java.lang.String getType(int pos)
Return the type of an attribute in this list (by position).
Specified by:
getType in interface org.xml.sax.AttributeList

getType

public java.lang.String getType(java.lang.String name)
Return the type of an attribute in this list (by name).
Specified by:
getType in interface org.xml.sax.AttributeList

getValue

public java.lang.String getValue(int pos)
Return the value of an attribute in this list (by position).
Specified by:
getValue in interface org.xml.sax.AttributeList

getValue

public java.lang.String getValue(java.lang.String name)
Return the value of an attribute in this list (by name).
Specified by:
getValue in interface org.xml.sax.AttributeList

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Handle the start of the document.

The default implementation does nothing.

Specified by:
startDocument in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#startDocument

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Handle the end of the document.

The default implementation does nothing.

Specified by:
endDocument in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#endDocument

resolveEntity

public java.lang.Object resolveEntity(java.lang.String publicId,
                                      java.lang.String systemId)
                               throws org.xml.sax.SAXException
Resolve an external entity.

The default implementation simply returns the supplied system identifier.

Specified by:
resolveEntity in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#resolveEntity

startExternalEntity

public void startExternalEntity(java.lang.String systemId)
                         throws org.xml.sax.SAXException
Handle the start of an external entity.

The default implementation does nothing.

Specified by:
startExternalEntity in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#startExternalEntity

endExternalEntity

public void endExternalEntity(java.lang.String systemId)
                       throws org.xml.sax.SAXException
Handle the end of an external entity.

The default implementation does nothing.

Specified by:
endExternalEntity in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#endExternalEntity

doctypeDecl

public void doctypeDecl(java.lang.String name,
                        java.lang.String publicId,
                        java.lang.String systemId)
                 throws org.xml.sax.SAXException
Handle a document type declaration.

The default implementation does nothing.

Specified by:
doctypeDecl in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#doctypeDecl

attribute

public void attribute(java.lang.String aname,
                      java.lang.String value,
                      boolean isSpecified)
               throws org.xml.sax.SAXException
Handle an attribute assignment.

The default implementation does nothing.

Specified by:
attribute in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#attribute

startElement

public void startElement(java.lang.String element)
                  throws org.xml.sax.SAXException
Handle the start of an element.

The default implementation does nothing.

Specified by:
startElement in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#startElement

endElement

public void endElement(java.lang.String element)
                throws org.xml.sax.SAXException
Handle the end of an element.

The default implementation does nothing.

Specified by:
endElement in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#endElement

charData

public void charData(char[] ch,
                     int start,
                     int length)
              throws org.xml.sax.SAXException
Handle character data.

The default implementation does nothing.

Specified by:
charData in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#charData

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Handle ignorable whitespace.

The default implementation does nothing.

Specified by:
ignorableWhitespace in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#ignorableWhitespace

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Handle a processing instruction.

The default implementation does nothing.

Specified by:
processingInstruction in interface XmlHandler
Throws:
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#processingInstruction

error

public void error(java.lang.String message,
                  java.lang.String systemId,
                  int line,
                  int column)
           throws org.xml.sax.SAXException
Throw an exception for a fatal error.

The default implementation throws XmlException.

Specified by:
error in interface XmlHandler
Throws:
com.microstar.xml.XmlException - A specific parsing error.
java.lang.Exception - Derived methods may throw exceptions.
See Also:
com.microstar.xml.XmlHandler#error

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Specified by:
comment in interface XmlHandler

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Specified by:
startCDATA in interface XmlHandler

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Specified by:
endCDATA in interface XmlHandler

endDoctype

public void endDoctype()
                throws org.xml.sax.SAXException
Specified by:
endDoctype in interface XmlHandler