Save This Page
Home » openjdk-7 » com.sun.org.apache.xml.internal » serialize » [javadoc | source]
com.sun.org.apache.xml.internal.serialize
public class: XML11Serializer [javadoc | source]
java.lang.Object
   com.sun.org.apache.xml.internal.serialize.BaseMarkupSerializer
      com.sun.org.apache.xml.internal.serialize.XMLSerializer
         com.sun.org.apache.xml.internal.serialize.XML11Serializer

All Implemented Interfaces:
    ContentHandler, DTDHandler, DocumentHandler, DeclHandler, Serializer, DOMSerializer, LexicalHandler

Implements an XML serializer supporting both DOM and SAX pretty serializing. For usage instructions see 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.

Field Summary
protected static final  boolean DEBUG     
protected  NamespaceSupport fNSBinder    stores namespaces in scope 
protected  NamespaceSupport fLocalNSBinder    stores all namespace bindings on the current element 
protected  SymbolTable fSymbolTable    symbol table for serialization 
protected  boolean fDOML1     
protected  int fNamespaceCounter     
protected static final  String PREFIX     
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. 
Fields inherited from com.sun.org.apache.xml.internal.serialize.XMLSerializer:
DEBUG,  fNSBinder,  fLocalNSBinder,  fSymbolTable,  PREFIX,  fNamespaces,  fNamespacePrefixes
Fields inherited from com.sun.org.apache.xml.internal.serialize.BaseMarkupSerializer:
features,  fDOMErrorHandler,  fDOMError,  fDOMFilter,  _encodingInfo,  _started,  _prefixes,  _docTypePublicId,  _docTypeSystemId,  _format,  _printer,  _indenting,  fStrBuffer,  fCurrentNode
Constructor:
 public XML11Serializer() 
 public XML11Serializer(OutputFormat format) 
 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 use
    format - The output format to use, null for the default
 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 use
    format - The output format to use, null for the default
Method from com.sun.org.apache.xml.internal.serialize.XML11Serializer Summary:
characters,   printCDATAText,   printEscaped,   printText,   printText,   printXMLChar,   reset,   surrogates
Methods from com.sun.org.apache.xml.internal.serialize.XMLSerializer:
checkUnboundNamespacePrefixedNode,   endElement,   endElement,   endElementIO,   getEntityRef,   printEscaped,   printText,   printText,   printXMLChar,   reset,   serializeElement,   setNamespaces,   setOutputFormat,   startDocument,   startElement,   startElement
Methods from com.sun.org.apache.xml.internal.serialize.BaseMarkupSerializer:
asContentHandler,   asDOMSerializer,   asDocumentHandler,   attributeDecl,   characters,   characters,   checkUnboundNamespacePrefixedNode,   comment,   comment,   content,   elementDecl,   endCDATA,   endDTD,   endDocument,   endEntity,   endNonEscaping,   endPrefixMapping,   endPreserving,   enterElementState,   externalEntityDecl,   fatalError,   getElementState,   getEntityRef,   getPrefix,   ignorableWhitespace,   internalEntityDecl,   isDocumentState,   leaveElementState,   modifyDOMError,   notationDecl,   prepare,   printCDATAText,   printDoctypeURL,   printEscaped,   printEscaped,   printHex,   printText,   printText,   processingInstruction,   processingInstructionIO,   reset,   serialize,   serialize,   serialize,   serialize,   serializeDTD,   serializeDocument,   serializeElement,   serializeNode,   serializePreRoot,   setDocumentLocator,   setOutputByteStream,   setOutputCharStream,   setOutputFormat,   skippedEntity,   startCDATA,   startDTD,   startDocument,   startEntity,   startNonEscaping,   startPrefixMapping,   startPreserving,   surrogates,   unparsedEntityDecl
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.org.apache.xml.internal.serialize.XML11Serializer Detail:
 public  void characters(char[] chars,
    int start,
    int length) throws SAXException 
 protected final  void printCDATAText(String text) throws IOException 
 protected  void printEscaped(String source) throws IOException 
 protected  void printText(String text,
    boolean preserveSpace,
    boolean unescaped) throws IOException 
 protected  void printText(char[] chars,
    int start,
    int length,
    boolean preserveSpace,
    boolean unescaped) throws IOException 
 protected final  void printXMLChar(int ch) throws IOException 
 public boolean reset() 
 protected final  void surrogates(int high,
    int low) throws IOException