|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sapportals.wcm.util.xml.SimpleSerializer
Simple DOM serializer. Only supports UTF-8 encoding and simple indentation (whitespace preservation not implemented - if whitespace preservation is required simply do not indent).
Copyright (c) SAP AG 2001-2005
| Nested Class Summary | |
static class |
SimpleSerializer.IllegalXmlNameException
|
| Field Summary | |
static String |
NS_XML
Namespace name for the namespace hardwired to the prefix "xml:" |
static String |
NS_XMLNS
Namespace name for the namespace hardwired to the prefix "xmlns:" |
| Constructor Summary | |
SimpleSerializer(Writer writer,
String indent)
Construct a new Serializer |
|
| Method Summary | |||
static void |
checkLegalNCName(String name)
Check whether a name is a legal |
void |
closeElement()
Closes the currently open element. |
static String |
escape(String s,
boolean escapeQuoteChar)
Escape characters in a string for inclusion into XML text content. |
||
SimpleSerializer |
openElement(Element element)
Serializes the open tag of the specified element and returns a new SimpleSerializer object for use in serializing any child elements (and writing the closing tag). |
||
void |
serialize(Node n)
Serialize a node and it's children. |
||
void |
setNsAware(boolean nsAware)
Set to false to switch off namespace processing (enabling
strict DOM level 1 serialization) |
||
void |
setOptimizeNSDeclarations(boolean doOptimize)
|
||
static String |
toString(Document doc,
boolean indent)
Serialize the document to a string. |
||
static String |
toString(Document doc,
boolean indent,
boolean doNsProcessing)
Serialize the document to a string. |
||
static String |
toString(Node n,
boolean indent)
Serialize the element (and it's children) to a string. |
||
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String NS_XML
public static final String NS_XMLNS
| Constructor Detail |
public SimpleSerializer(Writer writer,
String indent)
writer - outputindent - indentation string| Method Detail |
public static String toString(Document doc,
boolean indent)
doc - the documentindent - whether to produce indented XML or not
public static String toString(Document doc,
boolean indent,
boolean doNsProcessing)
doc - the documentindent - whether to produce indented XML or notdoNsProcessing - enable/disable special namespace support in the
serializer
public static String toString(Node n,
boolean indent)
throws IllegalArgumentException
indent - whether to produce indented XML or notn - node to serialize
IllegalArgumentException - when node is a AttributeNodepublic void setNsAware(boolean nsAware)
false to switch off namespace processing (enabling
strict DOM level 1 serialization)
nsAware - flagpublic void setOptimizeNSDeclarations(boolean doOptimize)
public SimpleSerializer openElement(Element element)
throws IOException
element - Element for which the start tag shall be written
IOException
public void closeElement()
throws IOException
IOException
public static String escape(String s,
boolean escapeQuoteChar)
throws IOException
s - un-escaped stringescapeQuoteChar - whether to escape the quote character or not (for attribute
values). Note that attributes are supposed to be quoted using
double quotes, so apostroph characters are not
replaced.
IOException - when quoting not possible
public void serialize(Node n)
throws IOException
n - start node
IOException
public static void checkLegalNCName(String name)
throws SimpleSerializer.IllegalXmlNameException
|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||