public abstract class Serializer
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
elem
Current tag.
|
protected int |
level
Current level.
|
static SerializerProp |
PROPS
Default serialization parameters.
|
protected TokenList |
tags
Stack of opened tags.
|
protected boolean |
undecl
Declare namespaces flag.
|
| Constructor and Description |
|---|
Serializer() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
atomic(Item i)
Serializes an atomic value.
|
protected abstract void |
attribute(byte[] name,
byte[] value)
Serializes an attribute.
|
void |
close()
Closes the serializer.
|
protected void |
closeDoc()
Closes a document.
|
protected void |
closeElement()
Closes an element.
|
protected void |
closeResult()
Closes a result.
|
protected abstract void |
finishClose()
Closes an element.
|
protected abstract void |
finishComment(byte[] v)
Serializes a comment.
|
boolean |
finished()
Tests if the serialization was interrupted.
|
protected abstract void |
finishEmpty()
Closes an empty element.
|
protected abstract void |
finishOpen()
Finishes an opening element node.
|
protected abstract void |
finishPi(byte[] n,
byte[] v)
Serializes a processing instruction.
|
protected abstract void |
finishText(byte[] v)
Serializes a text.
|
protected void |
finishText(byte[] v,
FTPos ftp)
Serializes a text.
|
static XMLSerializer |
get(java.io.OutputStream os)
Returns an XML serializer.
|
static Serializer |
get(java.io.OutputStream os,
SerializerProp props)
Returns a specific serializer.
|
protected void |
namespace(byte[] pref,
byte[] uri)
Serializes a namespace if it has not been serialized by an ancestor yet.
|
protected void |
openDoc(byte[] n)
Opens a document.
|
protected void |
openResult()
Starts a result.
|
void |
reset()
Resets the serializer (indentation, etc).
|
void |
serialize(ANode node)
Serializes the specified node.
|
void |
serialize(Item item)
Serializes the specified item, which may be a node or an atomic value.
|
protected void |
startElement(byte[] name,
byte[]... atts)
Opens an element.
|
protected abstract void |
startOpen(byte[] n)
Starts an element.
|
public static final SerializerProp PROPS
protected final TokenList tags
protected int level
protected byte[] elem
protected boolean undecl
public static XMLSerializer get(java.io.OutputStream os) throws java.io.IOException
os - output stream referencejava.io.IOException - I/O exceptionpublic static Serializer get(java.io.OutputStream os, SerializerProp props) throws java.io.IOException
os - output stream referenceprops - serialization properties (can be null)java.io.IOException - I/O exceptionpublic final void serialize(Item item) throws java.io.IOException
item - item to be serializedjava.io.IOException - I/O exceptionpublic void serialize(ANode node) throws java.io.IOException
node - node to be serializedjava.io.IOException - I/O exceptionpublic void close()
throws java.io.IOException
java.io.IOException - I/O exceptionpublic boolean finished()
public void reset()
protected final void startElement(byte[] name,
byte[]... atts)
throws java.io.IOException
name - tag nameatts - attributesjava.io.IOException - I/O exceptionprotected final void closeElement()
throws java.io.IOException
java.io.IOException - I/O exceptionprotected void finishText(byte[] v,
FTPos ftp)
throws java.io.IOException
v - valueftp - full-text positions, used for visualization highlightingjava.io.IOException - I/O exceptionprotected void namespace(byte[] pref,
byte[] uri)
throws java.io.IOException
pref - prefixuri - URIjava.io.IOException - I/O exceptionprotected void openResult()
throws java.io.IOException
java.io.IOException - I/O exceptionprotected void closeResult()
throws java.io.IOException
java.io.IOException - I/O exceptionprotected void openDoc(byte[] n)
throws java.io.IOException
n - namejava.io.IOException - I/O exceptionprotected void closeDoc()
throws java.io.IOException
java.io.IOException - I/O exceptionprotected abstract void attribute(byte[] name,
byte[] value)
throws java.io.IOException
name - namevalue - valuejava.io.IOException - I/O exceptionprotected abstract void startOpen(byte[] n)
throws java.io.IOException
n - tag namejava.io.IOException - I/O exceptionprotected abstract void finishOpen()
throws java.io.IOException
java.io.IOException - I/O exceptionprotected abstract void finishEmpty()
throws java.io.IOException
java.io.IOException - I/O exceptionprotected abstract void finishClose()
throws java.io.IOException
java.io.IOException - I/O exceptionprotected abstract void finishText(byte[] v)
throws java.io.IOException
v - valuejava.io.IOException - I/O exceptionprotected abstract void finishComment(byte[] v)
throws java.io.IOException
v - valuejava.io.IOException - I/O exceptionprotected abstract void finishPi(byte[] n,
byte[] v)
throws java.io.IOException
n - namev - valuejava.io.IOException - I/O exceptionprotected abstract void atomic(Item i) throws java.io.IOException
i - itemjava.io.IOException - I/O exception