com.sforce.ws.parser
Class MXSerializer

java.lang.Object
  extended by com.sforce.ws.parser.MXSerializer

public class MXSerializer
extends Object

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  boolean attributeUseApostrophe
           
protected  int autoDeclaredPrefixes
           
protected  char[] buf
           
protected  int depth
           
protected  boolean doIndent
           
protected  String[] elName
           
protected  String[] elNamespace
           
protected  int[] elNamespaceCount
           
protected  String FEATURE_NAMES_INTERNED
           
protected  String FEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE
           
protected  boolean finished
           
protected  char[] indentationBuf
           
protected  int indentationJump
           
protected  String indentationString
           
protected  String lineSeparator
           
protected  String location
           
protected  int maxIndentLevel
           
protected  boolean namesInterned
           
protected  int namespaceEnd
           
protected  String[] namespacePrefix
           
protected  String[] namespaceUri
           
protected  int offsetNewLine
           
protected  Writer out
           
protected  boolean pastRoot
           
protected static String[] precomputedPrefixes
           
protected static String PROPERTY_LOCATION
           
protected  String PROPERTY_SERIALIZER_INDENTATION
           
protected  String PROPERTY_SERIALIZER_LINE_SEPARATOR
           
protected  boolean seenBracket
           
protected  boolean seenBracketBracket
           
protected  boolean seenTag
           
protected  boolean setPrefixCalled
           
protected  boolean startTagIncomplete
           
protected  boolean writeIndentation
           
protected  boolean writeLineSepartor
           
protected static String XML_URI
           
protected static String XMLNS_URI
           
 
Constructor Summary
MXSerializer()
           
 
Method Summary
 MXSerializer attribute(String namespace, String name, String value)
           
 void cdsect(String text)
           
protected  void closeStartTag()
           
 void comment(String text)
           
 void docdecl(String text)
           
 void endDocument()
           
 MXSerializer endTag(String namespace, String name)
           
protected  void ensureElementsCapacity()
           
protected  void ensureNamespacesCapacity()
           
 void entityRef(String text)
           
 void flush()
           
 int getDepth()
           
 boolean getFeature(String name)
           
 String getName()
           
 String getNamespace()
           
 String getPrefix(String namespace, boolean generatePrefix)
           
 Object getProperty(String name)
           
 Writer getWriter()
           
 void ignorableWhitespace(String text)
           
protected  String lookupOrDeclarePrefix(String namespace)
           
protected static String printable(char ch)
           
protected static String printable(String s)
          simple utility method -- good for debugging
 void processingInstruction(String text)
           
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.
protected  void reset()
           
 void setFeature(String name, boolean state)
           
 void setOutput(OutputStream os, String encoding)
           
 void setOutput(Writer writer)
           
 void setPrefix(String prefix, String namespace)
           
 void setProperty(String name, Object value)
           
 void startDocument(String encoding, Boolean standalone)
           
 MXSerializer startTag(String namespace, String name)
           
 MXSerializer text(char[] buf, int start, int len)
           
 MXSerializer text(String text)
           
protected  void writeAttributeValue(String value, Writer out)
           
protected  void writeElementContent(char[] buf, int off, int len, Writer out)
           
protected  void writeElementContent(String text, Writer out)
           
protected  void writeIndent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_URI

protected static final String XML_URI
See Also:
Constant Field Values

XMLNS_URI

protected static final String XMLNS_URI
See Also:
Constant Field Values

FEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE

protected final String FEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE
See Also:
Constant Field Values

FEATURE_NAMES_INTERNED

protected final String FEATURE_NAMES_INTERNED
See Also:
Constant Field Values

PROPERTY_SERIALIZER_INDENTATION

protected final String PROPERTY_SERIALIZER_INDENTATION
See Also:
Constant Field Values

PROPERTY_SERIALIZER_LINE_SEPARATOR

protected final String PROPERTY_SERIALIZER_LINE_SEPARATOR
See Also:
Constant Field Values

PROPERTY_LOCATION

protected static final String PROPERTY_LOCATION
See Also:
Constant Field Values

namesInterned

protected boolean namesInterned

attributeUseApostrophe

protected boolean attributeUseApostrophe

indentationString

protected String indentationString

lineSeparator

protected String lineSeparator

location

protected String location

out

protected Writer out

autoDeclaredPrefixes

protected int autoDeclaredPrefixes

depth

protected int depth

elNamespace

protected String[] elNamespace

elName

protected String[] elName

elNamespaceCount

protected int[] elNamespaceCount

namespaceEnd

protected int namespaceEnd

namespacePrefix

protected String[] namespacePrefix

namespaceUri

protected String[] namespaceUri

finished

protected boolean finished

pastRoot

protected boolean pastRoot

setPrefixCalled

protected boolean setPrefixCalled

startTagIncomplete

protected boolean startTagIncomplete

doIndent

protected boolean doIndent

seenTag

protected boolean seenTag

seenBracket

protected boolean seenBracket

seenBracketBracket

protected boolean seenBracketBracket

buf

protected char[] buf

precomputedPrefixes

protected static final String[] precomputedPrefixes

offsetNewLine

protected int offsetNewLine

indentationJump

protected int indentationJump

indentationBuf

protected char[] indentationBuf

maxIndentLevel

protected int maxIndentLevel

writeLineSepartor

protected boolean writeLineSepartor

writeIndentation

protected boolean writeIndentation
Constructor Detail

MXSerializer

public MXSerializer()
Method Detail

reset

protected void reset()

ensureElementsCapacity

protected void ensureElementsCapacity()

ensureNamespacesCapacity

protected void ensureNamespacesCapacity()

setFeature

public void setFeature(String name,
                       boolean state)
                throws IllegalArgumentException,
                       IllegalStateException
Throws:
IllegalArgumentException
IllegalStateException

getFeature

public boolean getFeature(String name)
                   throws IllegalArgumentException
Throws:
IllegalArgumentException

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.


writeIndent

protected void writeIndent()
                    throws IOException
Throws:
IOException

setProperty

public void setProperty(String name,
                        Object value)
                 throws IllegalArgumentException,
                        IllegalStateException
Throws:
IllegalArgumentException
IllegalStateException

getProperty

public Object getProperty(String name)
                   throws IllegalArgumentException
Throws:
IllegalArgumentException

getWriter

public Writer getWriter()

setOutput

public void setOutput(Writer writer)

setOutput

public void setOutput(OutputStream os,
                      String encoding)
               throws IOException
Throws:
IOException

startDocument

public void startDocument(String encoding,
                          Boolean standalone)
                   throws IOException
Throws:
IOException

endDocument

public void endDocument()
                 throws IOException
Throws:
IOException

setPrefix

public void setPrefix(String prefix,
                      String namespace)
               throws IOException
Throws:
IOException

lookupOrDeclarePrefix

protected String lookupOrDeclarePrefix(String namespace)

getPrefix

public String getPrefix(String namespace,
                        boolean generatePrefix)

getDepth

public int getDepth()

getNamespace

public String getNamespace()

getName

public String getName()

startTag

public MXSerializer startTag(String namespace,
                             String name)
                      throws IOException
Throws:
IOException

attribute

public MXSerializer attribute(String namespace,
                              String name,
                              String value)
                       throws IOException
Throws:
IOException

closeStartTag

protected void closeStartTag()
                      throws IOException
Throws:
IOException

endTag

public MXSerializer endTag(String namespace,
                           String name)
                    throws IOException
Throws:
IOException

text

public MXSerializer text(String text)
                  throws IOException
Throws:
IOException

text

public MXSerializer text(char[] buf,
                         int start,
                         int len)
                  throws IOException
Throws:
IOException

cdsect

public void cdsect(String text)
            throws IOException
Throws:
IOException

entityRef

public void entityRef(String text)
               throws IOException
Throws:
IOException

processingInstruction

public void processingInstruction(String text)
                           throws IOException
Throws:
IOException

comment

public void comment(String text)
             throws IOException
Throws:
IOException

docdecl

public void docdecl(String text)
             throws IOException
Throws:
IOException

ignorableWhitespace

public void ignorableWhitespace(String text)
                         throws IOException
Throws:
IOException

flush

public void flush()
           throws IOException
Throws:
IOException

writeAttributeValue

protected void writeAttributeValue(String value,
                                   Writer out)
                            throws IOException
Throws:
IOException

writeElementContent

protected void writeElementContent(String text,
                                   Writer out)
                            throws IOException
Throws:
IOException

writeElementContent

protected void writeElementContent(char[] buf,
                                   int off,
                                   int len,
                                   Writer out)
                            throws IOException
Throws:
IOException

printable

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


printable

protected static String printable(char ch)


Copyright © 2012. All Rights Reserved.