|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xalan.serialize.SerializerToXML
SerializerToXML formats SAX-style events into XML.
Field Summary | |
int |
m_indentAmount
Amount to indent. |
boolean |
m_shouldNotWriteXMLHeader
Tells if we should write the XML declaration. |
boolean |
m_spaceBeforeClose
Add space before '/>' for XHTML. |
java.lang.String |
m_version
Tells the XML version, for writing out to the XML decl. |
Constructor Summary | |
SerializerToXML()
Default constructor. |
Method Summary | |
ContentHandler |
asContentHandler()
Return a ContentHandler interface into this serializer. |
DOMSerializer |
asDOMSerializer()
Return a DOMSerializer interface into this serializer. |
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. |
void |
CopyFrom(SerializerToXML xmlListener)
Copy properties from another SerializerToXML. |
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 namespaceURI,
java.lang.String localName,
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 |
endNonEscaping()
Ends an un-escaping section. |
void |
endPrefixMapping(java.lang.String prefix)
End the scope of a prefix-URI Namespace mapping. |
void |
endPreserving()
Ends a whitespace preserving section. |
void |
entityReference(java.lang.String name)
Receive notivication of a entityReference. |
void |
flush()
Flush all accumulated characters or bytes to the result stream. |
void |
flushWriter()
Flush the formatter's result stream. |
java.util.Properties |
getOutputFormat()
Returns the output format for this serializer. |
java.io.OutputStream |
getOutputStream()
Get the output stream where the events will be serialized to. |
java.io.Writer |
getWriter()
Get the character stream where the events will be serialized to. |
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,
java.util.Properties format)
Initialize the serializer with the specified output stream and output format. |
void |
init(java.io.Writer writer,
java.util.Properties format)
Initialize the serializer with the specified writer and output format. |
void |
printSpace(int n)
Prints n spaces. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Receive notification of a processing instruction. |
boolean |
reset()
Resets the serializer. |
void |
serialize(Node node)
Serializes the DOM node. |
void |
setDocumentLocator(Locator locator)
Receive an object for locating the origin of SAX document events. |
void |
setOutputFormat(java.util.Properties format)
Specifies an output format for this serializer. |
void |
setOutputStream(java.io.OutputStream output)
Specifies an output stream to which the document should be serialized. |
void |
setWriter(java.io.Writer writer)
Specifies a writer to which the document should be serialized. |
void |
skippedEntity(java.lang.String name)
Receive notification of a skipped entity. |
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 namespaceURI,
java.lang.String localName,
java.lang.String name,
Attributes atts)
Receive notification of the beginning of an element. |
void |
startEntity(java.lang.String name)
Report the beginning of an entity. |
void |
startNonEscaping()
Starts an un-escaping section. |
void |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Begin the scope of a prefix-URI Namespace mapping. |
void |
startPreserving()
Starts a whitespace preserving section. |
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_shouldNotWriteXMLHeader
public java.lang.String m_version
public int m_indentAmount
public boolean m_spaceBeforeClose
Constructor Detail |
public SerializerToXML()
Method Detail |
public void CopyFrom(SerializerToXML xmlListener)
xmlListener
- non-null reference to a SerializerToXML object.public void init(java.io.Writer writer, java.util.Properties format)
writer
- The writer to useformat
- The output formatpublic void init(java.io.OutputStream output, java.util.Properties format) throws java.io.UnsupportedEncodingException
output
- The output stream to useformat
- The output formatpublic void setDocumentLocator(Locator locator)
locator
- An object that can return the location of
any SAX document event.Locator
public void startDocument() throws SAXException
public void endDocument() throws SAXException
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws 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 SAXException
startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws SAXException
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void endPrefixMapping(java.lang.String prefix) throws SAXException
prefix
- The prefix that was being mapping.ContentHandler.endPrefixMapping(java.lang.String)
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String name, Attributes atts) throws SAXException
namespaceURI
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.name
- The element type name.atts
- The attributes attached to the element, if any.ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
,
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
,
AttributeList
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String name) throws SAXException
namespaceURI
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.name
- The element type namepublic void startNonEscaping() throws SAXException
The contents of the un-escaping section will be delivered through the regular characters event.
public void endNonEscaping() throws SAXException
startNonEscaping()
public void startPreserving() throws SAXException
The contents of the whitespace preserving section will be delivered through the regular characters event.
public void endPreserving() throws SAXException
startPreserving()
public void processingInstruction(java.lang.String target, java.lang.String data) throws 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 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 SAXException
endCDATA()
public void endCDATA() throws SAXException
startCDATA()
public void cdata(char[] ch, int start, int length) throws 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 SAXException
public final void flush() throws SAXException
public void characters(char[] chars, int start, int length) throws 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 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.public void ignorableWhitespace(char[] ch, int start, int length) throws 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 skippedEntity(java.lang.String name) throws SAXException
name
- The name of the skipped entity. If it is a
parameter entity, the name will begin with '%', and if
it is the external DTD subset, it will be the string
"[dtd]".ContentHandler.skippedEntity(java.lang.String)
public void startEntity(java.lang.String name) throws SAXException
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.endEntity(java.lang.String)
,
DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)
,
DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
public void endEntity(java.lang.String name) throws SAXException
name
- The name of the entity that is ending.startEntity(java.lang.String)
public void entityReference(java.lang.String name) throws SAXException
name
- The name of the entity.public void writeAttrString(java.lang.String string, java.lang.String encoding) throws SAXException
&#xnn
.string
- String to convert to XML format.encoding
- CURRENTLY NOT IMPLEMENTED.public void printSpace(int n) throws SAXException
pw
- The character output stream to use.n
- Number of spaces to print.public void indent(int n) throws SAXException
pw
- The character output stream to use.n
- Number of spaces to print.public void setOutputStream(java.io.OutputStream output)
The encoding specified in the output properties is used, or if no encoding was specified, the default for the selected output method.
output
- The output streampublic java.io.OutputStream getOutputStream()
public void setWriter(java.io.Writer writer)
writer
- The output writer streampublic java.io.Writer getWriter()
public void setOutputFormat(java.util.Properties format)
format
- The output format to usepublic java.util.Properties getOutputFormat()
public ContentHandler asContentHandler() throws java.io.IOException
ContentHandler
interface into this serializer.
If the serializer does not support the ContentHandler
interface, it should return null.ContentHandler
interface into this serializer,
or null if the serializer is not SAX 2 capablepublic DOMSerializer asDOMSerializer() throws java.io.IOException
DOMSerializer
interface into this serializer.
If the serializer does not support the DOMSerializer
interface, it should return null.DOMSerializer
interface into this serializer,
or null if the serializer is not DOM capablepublic boolean reset()
public void serialize(Node node) throws java.io.IOException
elem
- The element to serializenode
- Node to serialize.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |