BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xalan.serialize
Class SerializerToHTML

java.lang.Object
  |
  +--weblogic.apache.xalan.serialize.SerializerToXML
        |
        +--weblogic.apache.xalan.serialize.SerializerToHTML

public class SerializerToHTML
extends SerializerToXML

SerializerToHTML formats SAX-style events into XML.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.


Field Summary
protected static CharInfo m_htmlcharInfo
          Map that tells which XML characters should have special treatment, and it provides character to entity name lookup.
 
Fields inherited from class weblogic.apache.xalan.serialize.SerializerToXML
level, m_byteBuf, m_cdataSectionNames, m_cdataSectionStates, m_charBuf, m_charInfo, m_currentIndent, m_disableOutputEscapingStates, m_doIndent, m_elemStack, m_encoding, m_format, m_inCData, m_indentAmount, m_inEntityRef, m_ispreserve, m_isprevtext, m_lineSep, m_lineSepLen, m_outputStream, m_pos, m_preserves, m_shouldNotWriteXMLHeader, m_spaceBeforeClose, m_version, m_writer, m_xmlcharInfo
 
Constructor Summary
SerializerToHTML()
          Default constructor.
 
Method Summary
 void cdata(char[] ch, int start, int length)
          Receive notification of cdata.
 void characters(char[] chars, int start, int length)
          Receive notification of character data.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String name)
          Receive notification of the end of an element.
 void entityReference(java.lang.String name)
          Receive notivication of a entityReference.
 boolean getSpecialEscapeURLs()
          Tells if the formatter should use special URL escaping.
protected  void processAttribute(java.lang.String name, weblogic.apache.xalan.serialize.ElemDesc elemDesc, java.lang.String value)
          Process an attribute.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Receive notification of a processing instruction.
 void setOutputFormat(java.util.Properties format)
          Specifies an output format for this serializer.
 void setSpecialEscapeURLs(boolean bool)
          Tells if the formatter should use special URL escaping.
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String name, org.xml.sax.Attributes atts)
          Receive notification of the beginning of an element.
 void writeAttrString(java.lang.String string, java.lang.String encoding)
          Writes the specified string after substituting specials, and UTF-16 surrogates for character references &#xnn.
 void writeAttrURI(java.lang.String string, boolean doURLEscaping)
          Write the specified string after substituting non ASCII characters, with %HH, where HH is the hex of the byte value.
 
Methods inherited from class weblogic.apache.xalan.serialize.SerializerToXML
accum, accum, accum, accum, asContentHandler, asDOMSerializer, attributeDecl, charactersRaw, childNodesWereAdded, comment, CopyFrom, elementDecl, endCDATA, endDocument, endDTD, endEntity, endNonEscaping, endPrefixMapping, endPreserving, externalEntityDecl, flush, flushWriter, getOutputFormat, getOutputStream, getWriter, ignorableWhitespace, indent, init, init, internalEntityDecl, isCDataSection, isEscapingDisabled, openElementForChildren, outputLineSep, printSpace, processAttribute, pushState, reset, serialize, setDocumentLocator, setOutputStream, setWriter, shouldIndent, skippedEntity, startCDATA, startDTD, startEntity, startNonEscaping, startPrefixMapping, startPreserving, subPartMatch, writeParentTagEnd, writeUTF16Surrogate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_htmlcharInfo

protected static CharInfo m_htmlcharInfo
Map that tells which XML characters should have special treatment, and it provides character to entity name lookup.
Constructor Detail

SerializerToHTML

public SerializerToHTML()
Default constructor.
Method Detail

setSpecialEscapeURLs

public void setSpecialEscapeURLs(boolean bool)
Tells if the formatter should use special URL escaping.

Parameters:
bool - True if URLs should be specially escaped with the %xx form.

setOutputFormat

public void setOutputFormat(java.util.Properties format)
Specifies an output format for this serializer. It the serializer has already been associated with an output format, it will switch to the new format. This method should not be called while the serializer is in the process of serializing a document.

Parameters:
format - The output format to use
Overrides:
setOutputFormat in class SerializerToXML

getSpecialEscapeURLs

public boolean getSpecialEscapeURLs()
Tells if the formatter should use special URL escaping.

Returns:
True if URLs should be specially escaped with the %xx form.

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Receive notification of the beginning of a document.

Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.SAXException -  
Overrides:
startDocument in class SerializerToXML

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String name,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Receive notification of the beginning of an element.

Parameters:
namespaceURI -  
localName -  
name - The element type name.
atts - The attributes attached to the element, if any.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Overrides:
startElement in class SerializerToXML
See Also:
endElement(java.lang.String, java.lang.String, java.lang.String), AttributeList

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String name)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.

Parameters:
namespaceURI -  
localName -  
name - The element type name
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
Overrides:
endElement in class SerializerToXML

processAttribute

protected void processAttribute(java.lang.String name,
                                weblogic.apache.xalan.serialize.ElemDesc elemDesc,
                                java.lang.String value)
                         throws org.xml.sax.SAXException
Process an attribute.

Parameters:
name - The name of the attribute.
elemDesc - non-null reference to the owning element description.
value - The value of the attribute.
Throws:
org.xml.sax.SAXException -  

writeAttrURI

public void writeAttrURI(java.lang.String string,
                         boolean doURLEscaping)
                  throws org.xml.sax.SAXException
Write the specified string after substituting non ASCII characters, with %HH, where HH is the hex of the byte value.

Parameters:
string - String to convert to XML format.
doURLEscaping - True if we should try to encode as per http://www.ietf.org/rfc/rfc2396.txt.
Throws:
org.xml.sax.SAXException - if a bad surrogate pair is detected.

writeAttrString

public void writeAttrString(java.lang.String string,
                            java.lang.String encoding)
                     throws org.xml.sax.SAXException
Writes the specified string after substituting specials, and UTF-16 surrogates for character references &#xnn.

Parameters:
string - String to convert to XML format.
encoding - CURRENTLY NOT IMPLEMENTED.
Throws:
org.xml.sax.SAXException -  
Overrides:
writeAttrString in class SerializerToXML

characters

public void characters(char[] chars,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Receive notification of character data.

The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Note that some parsers will report whitespace using the ignorableWhitespace() method rather than this one (validating parsers must do so).

Parameters:
chars - The characters from the XML document.
start - The start position in the array.
length - The number of characters to read from the array.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.SAXException -  
Overrides:
characters in class SerializerToXML
See Also:
SerializerToXML.ignorableWhitespace(char[], int, int), Locator

cdata

public void cdata(char[] ch,
                  int start,
                  int length)
           throws org.xml.sax.SAXException
Receive notification of cdata.

The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.

The application must not attempt to read from the array outside of the specified range.

Note that some parsers will report whitespace using the ignorableWhitespace() method rather than this one (validating parsers must do so).

Parameters:
ch - The characters from the XML document.
start - The start position in the array.
length - The number of characters to read from the array.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.SAXException -  
Overrides:
cdata in class SerializerToXML
See Also:
SerializerToXML.ignorableWhitespace(char[], int, int), Locator

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Receive notification of a processing instruction.

Parameters:
target - The processing instruction target.
data - The processing instruction data, or null if none was supplied.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
org.xml.sax.SAXException -  
Overrides:
processingInstruction in class SerializerToXML

entityReference

public void entityReference(java.lang.String name)
                     throws org.xml.sax.SAXException
Receive notivication of a entityReference.

Parameters:
name - non-null reference to entity name string.
Throws:
org.xml.sax.SAXException -  
Overrides:
entityReference in class SerializerToXML

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.