org.codehaus.plexus.util.xml.pull

Class MXSerializer

public class MXSerializer extends Object implements XmlSerializer

Implementation of XmlSerializer interface from XmlPull V1 API. This implementation is optimzied for performance and low memory footprint.

Implemented features:

Implemented properties:

Field Summary
protected booleanattributeUseApostrophe
protected intautoDeclaredPrefixes
protected char[]buf
static intBUF_LEN
booleancheckNamesInterned
protected intdepth
protected booleandoIndent
protected String[]elName
protected String[]elNamespace
protected int[]elNamespaceCount
protected booleanfinished
protected StringFEATURE_NAMES_INTERNED
protected StringFEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE
protected char[]indentationBuf
protected intindentationJump
protected StringindentationString
protected StringlineSeparator
protected Stringlocation
protected intmaxIndentLevel
protected booleannamesInterned
protected intnamespaceEnd
protected String[]namespacePrefix
protected String[]namespaceUri
protected intoffsetNewLine
protected Writerout
protected booleanpastRoot
protected static String[]precomputedPrefixes
protected static StringPROPERTY_LOCATION
protected StringPROPERTY_SERIALIZER_INDENTATION
protected StringPROPERTY_SERIALIZER_LINE_SEPARATOR
protected booleanseenBracket
protected booleanseenBracketBracket
protected booleanseenTag
protected booleansetPrefixCalled
protected booleanstartTagIncomplete
static booleanTRACE_SIZING
protected booleanwriteIndentation
protected booleanwriteLineSepartor
protected static StringXMLNS_URI
protected static StringXML_URI
Method Summary
static voidaddPrintable(StringBuffer retval, char ch)
XmlSerializerattribute(String namespace, String name, String value)
voidcdsect(String text)
voidcheckInterning(String name)
protected voidcloseStartTag()
voidcomment(String text)
voiddocdecl(String text)
voidendDocument()
XmlSerializerendTag(String namespace, String name)
protected voidensureElementsCapacity()
protected voidensureNamespacesCapacity()
voidentityRef(String text)
voidflush()
StringgeneratePrefix(String namespace)
intgetDepth()
booleangetFeature(String name)
StringgetLocation()
StringgetName()
StringgetNamespace()
StringgetPrefix(String namespace, boolean generatePrefix)
ObjectgetProperty(String name)
WritergetWriter()
voidignorableWhitespace(String text)
protected StringlookupOrDeclarePrefix(String namespace)
protected static Stringprintable(String s)
simple utility method -- good for debugging
protected static Stringprintable(char ch)
voidprocessingInstruction(String text)
protected voidrebuildIndentationBuf()
For maximum efficiency when writing indents the required output is pre-computed This is internal function that recomputes buffer after user requested chnages.
protected voidreset()
voidsetFeature(String name, boolean state)
voidsetOutput(Writer writer)
voidsetOutput(OutputStream os, String encoding)
voidsetPrefix(String prefix, String namespace)
voidsetProperty(String name, Object value)
voidstartDocument(String encoding, Boolean standalone)
XmlSerializerstartTag(String namespace, String name)
XmlSerializertext(String text)
XmlSerializertext(char[] buf, int start, int len)
protected voidwriteAttributeValue(String value, Writer out)
protected voidwriteElementContent(String text, Writer out)
protected voidwriteElementContent(char[] buf, int off, int len, Writer out)
protected voidwriteIndent()
voidwriteNamespaceDeclarations()

Field Detail

attributeUseApostrophe

protected boolean attributeUseApostrophe

autoDeclaredPrefixes

protected int autoDeclaredPrefixes

buf

protected char[] buf

BUF_LEN

private static final int BUF_LEN

checkNamesInterned

private boolean checkNamesInterned

depth

protected int depth

doIndent

protected boolean doIndent

elName

protected String[] elName

elNamespace

protected String[] elNamespace

elNamespaceCount

protected int[] elNamespaceCount

finished

protected boolean finished

FEATURE_NAMES_INTERNED

protected final String FEATURE_NAMES_INTERNED

FEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE

protected final String FEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE

indentationBuf

protected char[] indentationBuf

indentationJump

protected int indentationJump

indentationString

protected String indentationString

lineSeparator

protected String lineSeparator

location

protected String location

maxIndentLevel

protected int maxIndentLevel

namesInterned

protected boolean namesInterned

namespaceEnd

protected int namespaceEnd

namespacePrefix

protected String[] namespacePrefix

namespaceUri

protected String[] namespaceUri

offsetNewLine

protected int offsetNewLine

out

protected Writer out

pastRoot

protected boolean pastRoot

precomputedPrefixes

protected static final String[] precomputedPrefixes

PROPERTY_LOCATION

protected static final String PROPERTY_LOCATION

PROPERTY_SERIALIZER_INDENTATION

protected final String PROPERTY_SERIALIZER_INDENTATION

PROPERTY_SERIALIZER_LINE_SEPARATOR

protected final String PROPERTY_SERIALIZER_LINE_SEPARATOR

seenBracket

protected boolean seenBracket

seenBracketBracket

protected boolean seenBracketBracket

seenTag

protected boolean seenTag

setPrefixCalled

protected boolean setPrefixCalled

startTagIncomplete

protected boolean startTagIncomplete

TRACE_SIZING

private static final boolean TRACE_SIZING

writeIndentation

protected boolean writeIndentation

writeLineSepartor

protected boolean writeLineSepartor

XMLNS_URI

protected static final String XMLNS_URI

XML_URI

protected static final String XML_URI

Method Detail

addPrintable

private static void addPrintable(StringBuffer retval, char ch)

attribute

public XmlSerializer attribute(String namespace, String name, String value)

cdsect

public void cdsect(String text)

checkInterning

private void checkInterning(String name)

closeStartTag

protected void closeStartTag()

comment

public void comment(String text)

docdecl

public void docdecl(String text)

endDocument

public void endDocument()

endTag

public XmlSerializer endTag(String namespace, String name)

ensureElementsCapacity

protected void ensureElementsCapacity()

ensureNamespacesCapacity

protected void ensureNamespacesCapacity()

entityRef

public void entityRef(String text)

flush

public void flush()

generatePrefix

private String generatePrefix(String namespace)

getDepth

public int getDepth()

getFeature

public boolean getFeature(String name)

getLocation

private String getLocation()

getName

public String getName()

getNamespace

public String getNamespace()

getPrefix

public String getPrefix(String namespace, boolean generatePrefix)

getProperty

public Object getProperty(String name)

getWriter

public Writer getWriter()

ignorableWhitespace

public void ignorableWhitespace(String text)

lookupOrDeclarePrefix

protected String lookupOrDeclarePrefix(String namespace)

printable

protected static final String printable(String s)
simple utility method -- good for debugging

printable

protected static final String printable(char ch)

processingInstruction

public void processingInstruction(String text)

rebuildIndentationBuf

protected void rebuildIndentationBuf()
For maximum efficiency when writing indents the required output is pre-computed This is internal function that recomputes buffer after user requested chnages.

reset

protected void reset()

setFeature

public void setFeature(String name, boolean state)

setOutput

public void setOutput(Writer writer)

setOutput

public void setOutput(OutputStream os, String encoding)

setPrefix

public void setPrefix(String prefix, String namespace)

setProperty

public void setProperty(String name, Object value)

startDocument

public void startDocument(String encoding, Boolean standalone)

startTag

public XmlSerializer startTag(String namespace, String name)

text

public XmlSerializer text(String text)

text

public XmlSerializer text(char[] buf, int start, int len)

writeAttributeValue

protected void writeAttributeValue(String value, Writer out)

writeElementContent

protected void writeElementContent(String text, Writer out)

writeElementContent

protected void writeElementContent(char[] buf, int off, int len, Writer out)

writeIndent

protected void writeIndent()

writeNamespaceDeclarations

private void writeNamespaceDeclarations()