|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xalan.serialize.SerializerToXML org.apache.xalan.serialize.SerializerToHTML
SerializerToHTML formats SAX-style events into XML.
Field Summary | |
private String |
m_currentElementName
The name of the current element. |
private static ElemDesc |
m_dummy
Dummy element for elements not found. |
(package private) static Trie |
m_elementFlags
A digital search trie for fast, case insensitive lookup of ElemDesc objects. |
protected static CharInfo |
m_htmlcharInfo
Map that tells which XML characters should have special treatment, and it provides character to entity name lookup. |
private boolean |
m_inBlockElem
True if the current element is a block element. |
protected BoolStack |
m_isRawStack
State stack to keep track of if the current element has output escaping disabled. |
private boolean |
m_omitMetaTag
True if the META tag should be omitted. |
private boolean |
m_specialEscapeURLs
True if URLs should be specially escaped with the %xx form. |
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. |
private int |
copyEntityIntoBuf(String s,
int pos)
Copy an entity into the accumulation buffer. |
void |
endElement(String namespaceURI,
String localName,
String name)
Receive notification of the end of an element. |
void |
entityReference(String name)
Receive notivication of a entityReference. |
(package private) ElemDesc |
getElemDesc(String name)
Get a description of the given element. |
boolean |
getOmitMetaTag()
Tells if the formatter should omit the META tag. |
boolean |
getSpecialEscapeURLs()
Tells if the formatter should use special URL escaping. |
private boolean |
isASCIIDigit(char c)
Tell if a character is an ASCII digit. |
private boolean |
isHHSign(String str)
Dmitri Ilyin: Makes sure if the String is HH encoded sign. |
private String |
makeHHString(int i)
Make an integer into an HH hex value. |
protected void |
processAttribute(String name,
ElemDesc elemDesc,
String value)
Process an attribute. |
void |
processingInstruction(String target,
String data)
Receive notification of a processing instruction. |
void |
setOmitMetaTag(boolean bool)
Tells if the formatter should omit the META tag. |
void |
setOutputFormat(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(String namespaceURI,
String localName,
String name,
org.xml.sax.Attributes atts)
Receive notification of the beginning of an element. |
void |
writeAttrString(String string,
String encoding)
Writes the specified string after substituting specials, and UTF-16 surrogates for character references &#xnn . |
void |
writeAttrURI(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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected BoolStack m_isRawStack
private boolean m_inBlockElem
protected static CharInfo m_htmlcharInfo
static Trie m_elementFlags
private static ElemDesc m_dummy
private boolean m_specialEscapeURLs
private boolean m_omitMetaTag
private String m_currentElementName
Constructor Detail |
public SerializerToHTML()
Method Detail |
public void setSpecialEscapeURLs(boolean bool)
bool
- True if URLs should be specially escaped with the %xx form.public void setOmitMetaTag(boolean bool)
bool
- True if the META tag should be omitted.public void setOutputFormat(Properties format)
setOutputFormat
in interface Serializer
setOutputFormat
in class SerializerToXML
format
- The output format to usepublic boolean getSpecialEscapeURLs()
public boolean getOmitMetaTag()
ElemDesc getElemDesc(String name)
name
- non-null name of element, case insensitive.
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class SerializerToXML
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
public void startElement(String namespaceURI, String localName, String name, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class SerializerToXML
namespaceURI
- localName
- name
- The element type name.atts
- The attributes attached to the element, if any.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.endElement(java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
public void endElement(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class SerializerToXML
namespaceURI
- localName
- name
- The element type name
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.protected void processAttribute(String name, ElemDesc elemDesc, String value) throws org.xml.sax.SAXException
name
- The name of the attribute.elemDesc
- non-null reference to the owning element description.value
- The value of the attribute.
org.xml.sax.SAXException
private boolean isASCIIDigit(char c)
private String makeHHString(int i)
i
- must be a value less than 255.
private boolean isHHSign(String str)
str
- must be 2 characters long
public void writeAttrURI(String string, boolean doURLEscaping) throws org.xml.sax.SAXException
%HH
, where HH is the hex of the byte value.
string
- String to convert to XML format.doURLEscaping
- True if we should try to encode as
per http://www.ietf.org/rfc/rfc2396.txt.
org.xml.sax.SAXException
- if a bad surrogate pair is detected.public void writeAttrString(String string, String encoding) throws org.xml.sax.SAXException
&#xnn
.
writeAttrString
in class SerializerToXML
string
- String to convert to XML format.encoding
- CURRENTLY NOT IMPLEMENTED.
org.xml.sax.SAXException
private int copyEntityIntoBuf(String s, int pos) throws org.xml.sax.SAXException
s
- The name of the entity.pos
- unused.
org.xml.sax.SAXException
public void characters(char[] chars, int start, int length) throws org.xml.sax.SAXException
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).
characters
in interface org.xml.sax.ContentHandler
characters
in class SerializerToXML
chars
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
SerializerToXML.ignorableWhitespace(char[], int, int)
,
Locator
public void cdata(char[] ch, int start, int length) throws org.xml.sax.SAXException
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).
cdata
in class SerializerToXML
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
SerializerToXML.ignorableWhitespace(char[], int, int)
,
Locator
public void processingInstruction(String target, String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
processingInstruction
in class SerializerToXML
target
- The processing instruction target.data
- The processing instruction data, or null if
none was supplied.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
public void entityReference(String name) throws org.xml.sax.SAXException
entityReference
in class SerializerToXML
name
- non-null reference to entity name string.
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |