org.basex.data
Class SAXSerializer

java.lang.Object
  extended by org.basex.data.Serializer
      extended by org.basex.data.SAXSerializer
All Implemented Interfaces:
org.xml.sax.XMLReader

public final class SAXSerializer
extends Serializer
implements org.xml.sax.XMLReader

This class allows to output XML results via SAX.

Author:
Workgroup DBIS, University of Konstanz 2005-08, ISC License, Christian Gruen

Field Summary
 
Fields inherited from class org.basex.data.Serializer
dn, ns, tags
 
Constructor Summary
SAXSerializer(Result res)
          Constructor.
 
Method Summary
 void attribute(byte[] n, byte[] v)
          Serializes an attribute.
 void close(byte[] t)
          Closes an element.
 void close(int s)
          Finishes the serializer.
 void closeResult()
          Closes a result.
 void comment(byte[] t)
          Serializes a comment.
 void empty()
          Finishes an empty element.
 void finish()
          Finishes an element.
 org.xml.sax.ContentHandler getContentHandler()
           
 org.xml.sax.DTDHandler getDTDHandler()
           
 org.xml.sax.EntityResolver getEntityResolver()
           
 org.xml.sax.ErrorHandler getErrorHandler()
           
 boolean getFeature(java.lang.String name)
           
 java.lang.Object getProperty(java.lang.String name)
           
 void item(byte[] b)
          Serializes an item.
 void open(int s)
          Initializes the serializer.
 void openResult()
          Starts a result.
 void parse(org.xml.sax.InputSource input)
           
 void parse(java.lang.String id)
           
 void pi(byte[] n, byte[] v)
          Serializes a processing instruction.
 void setContentHandler(org.xml.sax.ContentHandler c)
           
 void setDTDHandler(org.xml.sax.DTDHandler h)
           
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
           
 void setErrorHandler(org.xml.sax.ErrorHandler h)
           
 void setFeature(java.lang.String name, boolean value)
           
 void setLexicalHandler(org.xml.sax.ext.LexicalHandler l)
          Sets the lexical handler for reacting on comments.
 void setProperty(java.lang.String name, java.lang.Object value)
           
 void text(byte[] b)
          Serializes a text.
 
Methods inherited from class org.basex.data.Serializer
closeElement, emptyElement, emptyElement, emptyElement, finished, finishElement, namespace, node, openElement, openElement, pi, startElement, startElement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXSerializer

public SAXSerializer(Result res)
Constructor.

Parameters:
res - result
Method Detail

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
Specified by:
getContentHandler in interface org.xml.sax.XMLReader

getDTDHandler

public org.xml.sax.DTDHandler getDTDHandler()
Specified by:
getDTDHandler in interface org.xml.sax.XMLReader

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
Specified by:
getEntityResolver in interface org.xml.sax.XMLReader

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface org.xml.sax.XMLReader

getFeature

public boolean getFeature(java.lang.String name)
Specified by:
getFeature in interface org.xml.sax.XMLReader

getProperty

public java.lang.Object getProperty(java.lang.String name)
Specified by:
getProperty in interface org.xml.sax.XMLReader

parse

public void parse(org.xml.sax.InputSource input)
           throws org.xml.sax.SAXException
Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXException

parse

public void parse(java.lang.String id)
           throws org.xml.sax.SAXException
Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXException

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler c)
Specified by:
setContentHandler in interface org.xml.sax.XMLReader

setLexicalHandler

public void setLexicalHandler(org.xml.sax.ext.LexicalHandler l)
Sets the lexical handler for reacting on comments.

Parameters:
l - handler

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler h)
Specified by:
setDTDHandler in interface org.xml.sax.XMLReader

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
Specified by:
setEntityResolver in interface org.xml.sax.XMLReader

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler h)
Specified by:
setErrorHandler in interface org.xml.sax.XMLReader

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
Specified by:
setFeature in interface org.xml.sax.XMLReader

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Specified by:
setProperty in interface org.xml.sax.XMLReader

open

public void open(int s)
          throws java.io.IOException
Description copied from class: Serializer
Initializes the serializer.

Specified by:
open in class Serializer
Parameters:
s - number of results
Throws:
java.io.IOException - exception

close

public void close(int s)
           throws java.io.IOException
Description copied from class: Serializer
Finishes the serializer.

Specified by:
close in class Serializer
Parameters:
s - number of results
Throws:
java.io.IOException - exception

openResult

public void openResult()
                throws java.io.IOException
Description copied from class: Serializer
Starts a result.

Specified by:
openResult in class Serializer
Throws:
java.io.IOException - exception

closeResult

public void closeResult()
                 throws java.io.IOException
Description copied from class: Serializer
Closes a result.

Specified by:
closeResult in class Serializer
Throws:
java.io.IOException - exception

attribute

public void attribute(byte[] n,
                      byte[] v)
Description copied from class: Serializer
Serializes an attribute.

Specified by:
attribute in class Serializer
Parameters:
n - name
v - value

empty

public void empty()
           throws java.io.IOException
Description copied from class: Serializer
Finishes an empty element.

Throws:
java.io.IOException - exception

finish

public void finish()
            throws java.io.IOException
Description copied from class: Serializer
Finishes an element.

Throws:
java.io.IOException - exception

close

public void close(byte[] t)
           throws java.io.IOException
Description copied from class: Serializer
Closes an element.

Parameters:
t - tag
Throws:
java.io.IOException - exception

text

public void text(byte[] b)
          throws java.io.IOException
Description copied from class: Serializer
Serializes a text.

Specified by:
text in class Serializer
Parameters:
b - text bytes
Throws:
java.io.IOException - exception

comment

public void comment(byte[] t)
             throws java.io.IOException
Description copied from class: Serializer
Serializes a comment.

Specified by:
comment in class Serializer
Parameters:
t - comment
Throws:
java.io.IOException - exception

pi

public void pi(byte[] n,
               byte[] v)
        throws java.io.IOException
Description copied from class: Serializer
Serializes a processing instruction.

Specified by:
pi in class Serializer
Parameters:
n - name
v - value
Throws:
java.io.IOException - exception

item

public void item(byte[] b)
          throws java.io.IOException
Description copied from class: Serializer
Serializes an item.

Specified by:
item in class Serializer
Parameters:
b - text bytes
Throws:
java.io.IOException - exception