Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.xml.serialize.BaseMarkupSerializer
org.apache.xml.serialize.XMLSerializer
org.apache.xml.serialize.XML11Serializer
public class XML11Serializer
extends XMLSerializer
Serializer
.
If an output stream is used, the encoding is taken from the
output format (defaults to UTF-8). If a writer is
used, make sure the writer uses the same encoding (if applies)
as specified in the output format.
The serializer supports both DOM and SAX. SAX serializing is done by firing
SAX events and using the serializer as a document handler. DOM serializing is done
by calling serialize(Document)
or by using DOM Level 3
org.w3c.dom.ls.DOMSerializer
and
serializing with org.w3c.dom.ls.DOMSerializer.write
,
org.w3c.dom.ls.DOMSerializer.writeToString
.
If an I/O exception occurs while serializing, the serializer
will not throw an exception directly, but only throw it
at the end of serializing (either DOM or SAX's org.xml.sax.DocumentHandler.endDocument
.
For elements that are not specified as whitespace preserving,
the serializer will potentially break long text lines at space
boundaries, indent lines, and serialize elements on separate
lines. Line terminators will be regarded as spaces, and
spaces at beginning of line will be stripped.
Serializer
Field Summary | |
protected static boolean | |
protected static String | |
protected boolean | |
protected org.apache.xerces.util.NamespaceSupport |
|
protected org.apache.xerces.util.NamespaceSupport |
|
protected int | |
protected boolean |
|
protected org.apache.xerces.util.SymbolTable |
|
Fields inherited from class org.apache.xml.serialize.XMLSerializer | |
DEBUG , PREFIX , fLocalNSBinder , fNSBinder , fNamespacePrefixes , fNamespaces , fSymbolTable |
Fields inherited from class org.apache.xml.serialize.BaseMarkupSerializer | |
_docTypePublicId , _docTypeSystemId , _encodingInfo , _format , _indenting , _prefixes , _printer , _started , fCurrentNode , fDOMError , fDOMErrorHandler , fDOMFilter , fStrBuffer , features |
Constructor Summary | |
| |
| |
| |
|
Method Summary | |
void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
boolean |
|
protected void |
|
Methods inherited from class org.apache.xml.serialize.XMLSerializer | |
checkUnboundNamespacePrefixedNode , endElement , endElement , endElementIO , getEntityRef , printEscaped , printText , printText , printXMLChar , reset , serializeElement , setNamespaces , setOutputFormat , startDocument , startElement , startElement |
protected static final boolean DEBUG
- Field Value:
- false
protected static final String PREFIX
protected boolean fDOML1
protected org.apache.xerces.util.NamespaceSupport fLocalNSBinder
stores all namespace bindings on the current element
protected org.apache.xerces.util.NamespaceSupport fNSBinder
stores namespaces in scope
protected int fNamespaceCounter
protected boolean fNamespaces
Controls whether namespace fixup should be performed during the serialization. NOTE: if this field is set to true the following fields need to be initialized: fNSBinder, fLocalNSBinder, fSymbolTable, XMLSymbols.EMPTY_STRING, fXmlSymbol, fXmlnsSymbol, fNamespaceCounter.
protected org.apache.xerces.util.SymbolTable fSymbolTable
symbol table for serialization
public XML11Serializer()
Constructs a new serializer. The serializer cannot be used without callingXML11Serializer
orXML11Serializer
first.
public XML11Serializer(OutputStream output, OutputFormat format)
Constructs a new serializer that writes to the specified output stream using the specified output format. If format is null, will use a default output format.
- Parameters:
output
- The output stream to useformat
- The output format to use, null for the default
public XML11Serializer(Writer writer, OutputFormat format)
Constructs a new serializer that writes to the specified writer using the specified output format. If format is null, will use a default output format.
- Parameters:
writer
- The writer to useformat
- The output format to use, null for the default
public XML11Serializer(OutputFormat format)
Constructs a new serializer. The serializer cannot be used without callingXML11Serializer
orXML11Serializer
first.
public void characters(char[] chars, int start, int length) throws org.xml.sax.SAXException
- Overrides:
- characters in interface BaseMarkupSerializer
protected final void printCDATAText(String text) throws IOException
- Overrides:
- printCDATAText in interface BaseMarkupSerializer
protected void printEscaped(String source) throws IOException
- Overrides:
- printEscaped in interface XMLSerializer
protected void printText(String text, boolean preserveSpace, boolean unescaped) throws IOException
- Overrides:
- printText in interface XMLSerializer
protected void printText(char[] chars, int start, int length, boolean preserveSpace, boolean unescaped) throws IOException
- Overrides:
- printText in interface XMLSerializer
protected final void printXMLChar(int ch) throws IOException
print text data
- Overrides:
- printXMLChar in interface XMLSerializer
protected final void surrogates(int high, int low, boolean inContent) throws IOException
- Overrides:
- surrogates in interface BaseMarkupSerializer