|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xalan.xpath.xml.FormatterToXML
FormatterToXML formats SAX-style events into XML. Warning: this class will be replaced by the Xerces Serializer classes.
Field Summary | |
int |
indent
Amount to indent. |
char[] |
m_attrCharsMap
|
char[] |
m_attrSpecialChars
These are characters that will be escaped in the output. |
char[] |
m_charsMap
|
boolean |
m_escapeCData
If true, characters in cdata sections are escaped, instead of being writted out as cdata sections. |
boolean |
m_shouldNotWriteXMLHeader
Tells if we should write the XML declaration. |
boolean |
m_spaceBeforeClose
Add space before '/>' for XHTML. |
boolean |
m_stripCData
If true, cdata sections are simply stripped of their CDATA brackets, without escaping. |
java.lang.String |
m_version
Tells the XML version, for writing out to the XML decl. |
Constructor Summary | |
FormatterToXML()
Default constructor. |
|
FormatterToXML(FormatterToXML xmlListener)
Constructor using a writer. |
|
FormatterToXML(java.io.OutputStream os)
Constructor using an output stream, and a simple OutputFormat. |
|
FormatterToXML(java.io.Writer writer)
Constructor using a writer. |
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 |
charactersRaw(char[] ch,
int start,
int length)
If available, when the disable-output-escaping attribute is used, output raw text without escaping. |
void |
comment(char[] ch,
int start,
int length)
Report an XML comment anywhere in the document. |
static java.lang.String |
convertJava2MimeEncoding(java.lang.String encoding)
Convert a Java encoding name to MIME charset name. |
static java.lang.String |
convertMime2JavaEncoding(java.lang.String mimeCharsetName)
Convert a MIME charset name, also known as an XML encoding name, to a Java encoding name. |
void |
endCDATA()
Report the end of a CDATA section. |
void |
endDocument()
Receive notification of the end of a document. |
void |
endDTD()
Report the end of DTD declarations. |
void |
endElement(java.lang.String name)
Receive notification of the end of an element. |
void |
endEntity(java.lang.String name)
Report the end of an entity. |
void |
entityReference(java.lang.String name)
Receive notivication of a entityReference. |
void |
flush()
|
void |
flushWriter()
Flush the formatter's result stream. |
java.io.Writer |
getWriter()
Return the Writer. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable whitespace in element content. |
void |
indent(int n)
Prints a newline character and n spaces. |
void |
init(java.io.OutputStream output,
org.apache.xml.serialize.OutputFormat format)
Initialize the serializer with the specified output stream and output format. |
void |
init(java.io.Writer writer,
org.apache.xml.serialize.OutputFormat format)
Initialize the serializer with the specified writer and output format. |
static void |
initEncodings()
|
void |
printSpace(int n)
Prints n spaces. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Receive notification of a processing instruction. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Receive an object for locating the origin of SAX document events. |
void |
startCDATA()
Report the start of a CDATA section. |
void |
startDocument()
Receive notification of the beginning of a document. |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Report the start of DTD declarations, if any. |
void |
startElement(java.lang.String name,
org.xml.sax.AttributeList atts)
Receive notification of the beginning of an element. |
void |
startEntity(java.lang.String name)
Report the beginning of an entity. |
void |
writeAttrString(java.lang.String string,
java.lang.String encoding)
Returns the specified string after substituting specials, and UTF-16 surrogates for chracter references &#xnn . |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public boolean m_stripCData
public boolean m_escapeCData
public boolean m_shouldNotWriteXMLHeader
public java.lang.String m_version
public int indent
public char[] m_attrSpecialChars
public char[] m_attrCharsMap
public char[] m_charsMap
public boolean m_spaceBeforeClose
Constructor Detail |
public FormatterToXML()
public FormatterToXML(java.io.Writer writer)
writer
- The character output stream to use.public FormatterToXML(java.io.OutputStream os) throws java.io.UnsupportedEncodingException
writer
- The character output stream to use.public FormatterToXML(FormatterToXML xmlListener)
writer
- The character output stream to use.Method Detail |
public java.io.Writer getWriter()
public void init(java.io.Writer writer, org.apache.xml.serialize.OutputFormat format)
writer
- The writer to useformat
- The output formatpublic void init(java.io.OutputStream output, org.apache.xml.serialize.OutputFormat format) throws java.io.UnsupportedEncodingException
output
- The output stream to useformat
- The output formatpublic void setDocumentLocator(org.xml.sax.Locator locator)
locator
- An object that can return the location of
any SAX document event.Locator
public void startDocument() throws org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
name
- The document type name.publicId
- The declared public identifier for the
external DTD subset, or null if none was declared.systemId
- The declared system identifier for the
external DTD subset, or null if none was declared.endDTD()
,
startEntity(java.lang.String)
public void endDTD() throws org.xml.sax.SAXException
startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startElement(java.lang.String name, org.xml.sax.AttributeList atts) throws org.xml.sax.SAXException
name
- The element type name.atts
- The attributes attached to the element, if any.endElement(java.lang.String)
,
AttributeList
public void endElement(java.lang.String name) throws org.xml.sax.SAXException
name
- The element type namepublic void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
target
- The processing instruction target.data
- The processing instruction data, or null if
none was supplied.public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
ch
- An array holding the characters in the comment.start
- The starting position in the array.length
- The number of characters to use from the array.public void startCDATA() throws org.xml.sax.SAXException
endCDATA()
public void endCDATA() throws org.xml.sax.SAXException
startCDATA()
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).
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.ignorableWhitespace(char[], int, int)
,
Locator
public final void flushWriter() throws org.xml.sax.SAXException
public final void flush() throws 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).
chars
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.ignorableWhitespace(char[], int, int)
,
Locator
public void charactersRaw(char[] ch, int start, int length) throws org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.characters(char[], int, int)
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.endEntity(java.lang.String)
,
org.xml.sax.misc.DeclHandler#internalEntityDecl
,
org.xml.sax.misc.DeclHandler#externalEntityDecl
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
name
- The name of the entity that is ending.startEntity(java.lang.String)
public void entityReference(java.lang.String name) throws org.xml.sax.SAXException
public void writeAttrString(java.lang.String string, java.lang.String encoding) throws org.xml.sax.SAXException
&#xnn
.string
- String to convert to XML format.specials
- Chracters, should be represeted in chracter referenfces.encoding
- CURRENTLY NOT IMPLEMENTED.#backReference
public void printSpace(int n) throws org.xml.sax.SAXException
pw
- The character output stream to use.n
- Number of spaces to print.public void indent(int n) throws org.xml.sax.SAXException
pw
- The character output stream to use.n
- Number of spaces to print.public static void initEncodings()
public static java.lang.String convertMime2JavaEncoding(java.lang.String mimeCharsetName) throws java.io.UnsupportedEncodingException
mimeCharsetName
- Case insensitive MIME charset name: UTF-8, US-ASCII, ISO-8859-1,
ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6,
ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-2022-JP, Shift_JIS,
EUC-JP, GB2312, Big5, EUC-KR, ISO-2022-KR, KOI8-R,
EBCDIC-CP-US, EBCDIC-CP-CA, EBCDIC-CP-NL, EBCDIC-CP-DK,
EBCDIC-CP-NO, EBCDIC-CP-FI, EBCDIC-CP-SE, EBCDIC-CP-IT,
EBCDIC-CP-ES, EBCDIC-CP-GB, EBCDIC-CP-FR, EBCDIC-CP-AR1,
EBCDIC-CP-HE, EBCDIC-CP-CH, EBCDIC-CP-ROECE, EBCDIC-CP-YU,
EBCDIC-CP-IS and EBCDIC-CP-AR2
.#reverse
public static java.lang.String convertJava2MimeEncoding(java.lang.String encoding)
encoding
- Case insensitive Java encoding name: UTF8, ISO8859_1, ISO8859_2, ISO8859_3,
ISO8859_4, ISO8859_5, ISO8859_6, ISO8859_7, ISO8859_8, ISO8859_9, JIS, SJIS, EUCJIS,
GB2312, BIG5, KSC5601, ISO2022KR, KOI8_R, CP037, CP277, CP278,
CP280, CP284, CP285, CP297, CP420, CP424, CP500, CP870, CP871
and CP918
.#convert
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |