org.basex.data
Class Serializer

java.lang.Object
  extended by org.basex.data.Serializer
Direct Known Subclasses:
DOTSerializer, SAXSerializer, XMLSerializer

public abstract class Serializer
extends java.lang.Object

This is an interface for serializing XML results.

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

Field Summary
 byte[] dn
          Current default namespace.
 Atts ns
          Namespaces.
 TokenList tags
          Opened tags.
 
Constructor Summary
Serializer()
           
 
Method Summary
abstract  void attribute(byte[] n, byte[] v)
          Serializes an attribute.
abstract  void close(int s)
          Finishes the serializer.
 void closeElement()
          Closes an element.
abstract  void closeResult()
          Closes a result.
abstract  void comment(byte[] b)
          Serializes a comment.
 void emptyElement()
          Finishes a new element node.
 void emptyElement(byte[] t, byte[]... a)
          Opens and closes an empty element.
 void emptyElement(ExprInfo expr, byte[]... a)
          Opens and closes an empty element.
 boolean finished()
          Tests if the serialization was interrupted.
 void finishElement()
          Finishes a new element node.
abstract  void item(byte[] b)
          Serializes an item.
 void namespace(byte[] n, byte[] v)
          Serializes a namespace.
 int node(Data data, int pre)
          Serializes a node of the specified data reference.
abstract  void open(int s)
          Initializes the serializer.
 void openElement(byte[] t, byte[]... a)
          Opens an element.
 void openElement(ExprInfo expr, byte[]... a)
          Opens an element.
abstract  void openResult()
          Starts a result.
 void pi(byte[] c)
          Serializes a processing instruction.
abstract  void pi(byte[] n, byte[] v)
          Serializes a processing instruction.
 void startElement(byte[] t)
          Starts a new element node.
 void startElement(ExprInfo expr)
          Starts a new element node.
abstract  void text(byte[] b)
          Serializes a text.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ns

public Atts ns
Namespaces.


tags

public TokenList tags
Opened tags.


dn

public byte[] dn
Current default namespace.

Constructor Detail

Serializer

public Serializer()
Method Detail

open

public abstract void open(int s)
                   throws java.io.IOException
Initializes the serializer.

Parameters:
s - number of results
Throws:
java.io.IOException - exception

close

public abstract void close(int s)
                    throws java.io.IOException
Finishes the serializer.

Parameters:
s - number of results
Throws:
java.io.IOException - exception

openResult

public abstract void openResult()
                         throws java.io.IOException
Starts a result.

Throws:
java.io.IOException - exception

closeResult

public abstract void closeResult()
                          throws java.io.IOException
Closes a result.

Throws:
java.io.IOException - exception

attribute

public abstract void attribute(byte[] n,
                               byte[] v)
                        throws java.io.IOException
Serializes an attribute.

Parameters:
n - name
v - value
Throws:
java.io.IOException - exception

text

public abstract void text(byte[] b)
                   throws java.io.IOException
Serializes a text.

Parameters:
b - text bytes
Throws:
java.io.IOException - exception

comment

public abstract void comment(byte[] b)
                      throws java.io.IOException
Serializes a comment.

Parameters:
b - comment
Throws:
java.io.IOException - exception

pi

public abstract void pi(byte[] n,
                        byte[] v)
                 throws java.io.IOException
Serializes a processing instruction.

Parameters:
n - name
v - value
Throws:
java.io.IOException - exception

item

public abstract void item(byte[] b)
                   throws java.io.IOException
Serializes an item.

Parameters:
b - text bytes
Throws:
java.io.IOException - exception

startElement

public final void startElement(ExprInfo expr)
                        throws java.io.IOException
Starts a new element node.

Parameters:
expr - expression info
Throws:
java.io.IOException - exception

startElement

public final void startElement(byte[] t)
                        throws java.io.IOException
Starts a new element node.

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

openElement

public final void openElement(ExprInfo expr,
                              byte[]... a)
                       throws java.io.IOException
Opens an element.

Parameters:
expr - expression info
a - attributes
Throws:
java.io.IOException - exception

openElement

public final void openElement(byte[] t,
                              byte[]... a)
                       throws java.io.IOException
Opens an element.

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

namespace

public final void namespace(byte[] n,
                            byte[] v)
                     throws java.io.IOException
Serializes a namespace.

Parameters:
n - name
v - value
Throws:
java.io.IOException - exception

emptyElement

public final void emptyElement(ExprInfo expr,
                               byte[]... a)
                        throws java.io.IOException
Opens and closes an empty element.

Parameters:
expr - expression info
a - attributes
Throws:
java.io.IOException - exception

emptyElement

public final void emptyElement(byte[] t,
                               byte[]... a)
                        throws java.io.IOException
Opens and closes an empty element.

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

emptyElement

public final void emptyElement()
                        throws java.io.IOException
Finishes a new element node.

Throws:
java.io.IOException - exception

finishElement

public final void finishElement()
                         throws java.io.IOException
Finishes a new element node.

Throws:
java.io.IOException - exception

closeElement

public final void closeElement()
                        throws java.io.IOException
Closes an element.

Throws:
java.io.IOException - exception

pi

public final void pi(byte[] c)
              throws java.io.IOException
Serializes a processing instruction.

Parameters:
c - content
Throws:
java.io.IOException - exception

finished

public boolean finished()
Tests if the serialization was interrupted.

Returns:
result of check

node

public final int node(Data data,
                      int pre)
               throws java.io.IOException
Serializes a node of the specified data reference.

Parameters:
data - data reference
pre - pre value to start from
Returns:
last pre value
Throws:
java.io.IOException - exception