com.sapportals.wcm.util.xml

Class SAXSerializer

java.lang.Object
  extended by com.sapportals.wcm.util.xml.SAXSerializer
All Implemented Interfaces:
ContentHandler

public final class SAXSerializer
extends Object
implements ContentHandler

Simple SAX serializer. Only supports simple indentation (whitespace preservation not implemented - if whitespace preservation is required simply do not indent).

Copyright (c) SAP AG 2003-2005


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:"
 
Method Summary
 void characters(char[] chars, int offset, int length)
           
 void endDocument()
           
 void endElement(String namespace, String localname, String qname)
           
 void endPrefixMapping(String prefix)
           
static String escape(String s, boolean escapeQuoteChar)
          Escape characters in a string for inclusion into XML text content.
static SAXSerializer getInstance(OutputStream out, String encoding, boolean indent)
           
static SAXSerializer getInstance(Writer writer, boolean indent)
           
 void ignorableWhitespace(char[] chars, int i, int i1)
           
 void processingInstruction(String target, String data)
           
 void setDocumentLocator(Locator locator)
           
 void skippedEntity(String s)
           
 void startDocument()
           
 void startElement(String namespace, String localname, String qname, Attributes attributes)
           
 void startPrefixMapping(String prefix, String namespace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NS_XML

public static final String NS_XML
Namespace name for the namespace hardwired to the prefix "xml:"

See Also:
Constant Field Values

NS_XMLNS

public static final String NS_XMLNS
Namespace name for the namespace hardwired to the prefix "xmlns:"

See Also:
Constant Field Values
Method Detail

getInstance

public static SAXSerializer getInstance(Writer writer,
                                        boolean indent)

getInstance

public static SAXSerializer getInstance(OutputStream out,
                                        String encoding,
                                        boolean indent)
                                 throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String namespace)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Specified by:
endPrefixMapping in interface ContentHandler
Throws:
SAXException

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

startElement

public void startElement(String namespace,
                         String localname,
                         String qname,
                         Attributes attributes)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Throws:
SAXException

endElement

public void endElement(String namespace,
                       String localname,
                       String qname)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Throws:
SAXException

characters

public void characters(char[] chars,
                       int offset,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] chars,
                                int i,
                                int i1)
                         throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Specified by:
processingInstruction in interface ContentHandler
Throws:
SAXException

setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface ContentHandler

skippedEntity

public void skippedEntity(String s)
                   throws SAXException
Specified by:
skippedEntity in interface ContentHandler
Throws:
SAXException

escape

public static String escape(String s,
                            boolean escapeQuoteChar)
                     throws SAXException
Escape characters in a string for inclusion into XML text content. The generated string is guaranteed to only contain characters from the US-ASCII character set.

Parameters:
s - un-escaped string
escapeQuoteChar - 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.
Returns:
escaped string
Throws:
SAXException - Exception raised in failure situation
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2014 SAP AG Complete Copyright Notice