org.basex.data
Class XMLSerializer

java.lang.Object
  extended by org.basex.data.Serializer
      extended by org.basex.data.XMLSerializer

public final class XMLSerializer
extends Serializer

This is an interface for serializing XML results.

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

Field Summary
static java.lang.String INDENT
          Indentation.
 PrintOutput out
          Output stream.
 
Fields inherited from class org.basex.data.Serializer
dn, ns
 
Constructor Summary
XMLSerializer(PrintOutput o)
          Constructor.
XMLSerializer(PrintOutput o, boolean x, boolean p)
          Constructor.
 
Method Summary
 void attribute(byte[] n, byte[] v)
          Serializes an attribute.
 void closeResult()
          Closes a result.
 void cls()
          Closes the serializer.
 void comment(byte[] n)
          Serializes a comment.
 boolean finished()
          Tests if the serialization was interrupted.
 void item(byte[] b)
          Serializes an item.
 void openResult()
          Starts a result.
 void pi(byte[] n, byte[] v)
          Serializes a processing instruction.
 void text(byte[] b)
          Serializes a text.
 void text(byte[] b, FTPos ftp)
          Serializes a text.
 
Methods inherited from class org.basex.data.Serializer
close, closeElement, emptyElement, emptyElement, level, namespace, node, node, openElement, openElement
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDENT

public static final java.lang.String INDENT
Indentation.

See Also:
Constant Field Values

out

public final PrintOutput out
Output stream.

Constructor Detail

XMLSerializer

public XMLSerializer(PrintOutput o)
              throws java.io.IOException
Constructor.

Parameters:
o - output stream reference
Throws:
java.io.IOException - I/O exception

XMLSerializer

public XMLSerializer(PrintOutput o,
                     boolean x,
                     boolean p)
              throws java.io.IOException
Constructor.

Parameters:
o - output stream reference
x - serialize result as well-formed xml
p - pretty print the result
Throws:
java.io.IOException - I/O exception
Method Detail

cls

public void cls()
         throws java.io.IOException
Description copied from class: Serializer
Closes the serializer.

Throws:
java.io.IOException - I/O 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 - I/O 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 - I/O exception

attribute

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

Specified by:
attribute in class Serializer
Parameters:
n - name
v - value
Throws:
java.io.IOException - I/O 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 - I/O exception

text

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

Specified by:
text in class Serializer
Parameters:
b - text bytes
ftp - full-text positions
Throws:
java.io.IOException - I/O exception

comment

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

Specified by:
comment in class Serializer
Parameters:
n - comment
Throws:
java.io.IOException - I/O 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 - I/O 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 - I/O exception

finished

public boolean finished()
Description copied from class: Serializer
Tests if the serialization was interrupted.

Overrides:
finished in class Serializer
Returns:
result of check