|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xalan.serialize.SerializerToXML
SerializerToXML formats SAX-style events into XML.
Field Summary | |
private static boolean |
DEBUG
Indicate whether running in Debug mode |
(package private) static boolean |
javaEncodingIsISO
Assume java encoding names are the same as the ISO encoding names if this is true. |
protected int |
level
Current level of indent. |
(package private) Method |
m_canConvertMeth
Method reference to the sun.io.CharToByteConverter#canConvert method for this encoding. |
protected Vector |
m_cdataSectionNames
List of QNames obtained from the xsl:output properties. |
protected BoolStack |
m_cdataSectionStates
True will be pushed, if characters should be in CDATA section blocks. |
protected CharInfo |
m_charInfo
Map that tells which characters should have special treatment, and it provides character to entity name lookup. |
private static Hashtable |
m_charInfos
Table of user-specified char infos. |
(package private) Object |
m_charToByteConverter
Opaque reference to the sun.io.CharToByteConverter for this encoding. |
protected int |
m_currentIndent
Flag to keep track of the indent amount. |
protected BoolStack |
m_disableOutputEscapingStates
Stack to keep track of disabling output escaping. |
(package private) String |
m_doctypePublic
The public ID for the doc type. |
(package private) String |
m_doctypeSystem
The System ID for the doc type. |
protected boolean |
m_doIndent
Flag to tell if indenting (pretty-printing) is on. |
private String |
m_elemName
NEEDSDOC Field m_elemName |
protected BoolStack |
m_elemStack
A stack of Boolean objects that tell if the given element has children. |
protected String |
m_encoding
The character encoding. |
protected Properties |
m_format
The xsl:output properties. |
protected boolean |
m_inCData
True if the current characters should be in CDATA blocks. |
int |
m_indentAmount
Amount to indent. |
private boolean |
m_inDoctype
Tells if we're in an internal document type subset. |
protected boolean |
m_inEntityRef
Tells if we're in an EntityRef event. |
private boolean |
m_inExternalDTD
This flag is set while receiving events from the external DTD |
protected boolean |
m_ispreserve
State flag to tell if preservation of whitespace is important. |
protected boolean |
m_isprevtext
State flag that tells if the previous node processed was text, so we can tell if we should preserve whitespace. |
(package private) boolean |
m_isUTF8
Flag to quickly tell if the encoding is UTF8. |
protected char[] |
m_lineSep
Use the system line seperator to write line breaks. |
protected int |
m_lineSepLen
The length of the line seperator, since the write is done one character at a time. |
protected int |
m_maxCharacter
The maximum character size before we have to resort to escaping. |
(package private) String |
m_mediatype
The mediatype. |
(package private) boolean |
m_needToOutputDocTypeDecl
Flag to tell that we need to add the doctype decl, which we can't do until the first element is encountered. |
protected int |
m_pos
The current position in the m_charBuf or m_byteBuf. |
protected BoolStack |
m_preserves
Stack to keep track of whether or not we need to preserve whitespace. |
(package private) boolean |
m_shouldFlush
True if we control the buffer, and we should flush the output on endDocument. |
boolean |
m_shouldNotWriteXMLHeader
Tells if we should write the XML declaration. |
boolean |
m_spaceBeforeClose
Add space before '/>' for XHTML. |
(package private) boolean |
m_standalone
The standalone value for the doctype. |
(package private) boolean |
m_standaloneWasSpecified
True if standalone was specified. |
(package private) boolean |
m_startNewLine
Flag to signal that a newline should be added. |
(package private) boolean |
m_triedToGetConverter
Boolean that tells if we already tried to get the converter. |
String |
m_version
Tells the XML version, for writing out to the XML decl. |
protected Writer |
m_writer
The writer where the XML will be written. |
protected static CharInfo |
m_xmlcharInfo
Map that tells which XML characters should have special treatment, and it provides character to entity name lookup. |
Constructor Summary | |
SerializerToXML()
Default constructor. |
Method Summary | |
protected void |
accum(char b)
Append a character to the buffer. |
protected void |
accum(char[] chars,
int start,
int length)
Append a character to the buffer. |
protected void |
accum(String s)
Append a character to the buffer. |
protected int |
accumDefaultEntity(char ch,
int i,
char[] chars,
int len,
boolean escLF)
Handle one of the default entities, return false if it is not a default entity. |
protected int |
accumDefaultEscape(char ch,
int i,
char[] chars,
int len,
boolean escLF)
Escape and m_writer.write a character. |
org.xml.sax.ContentHandler |
asContentHandler()
Return a ContentHandler interface into this serializer.
|
DOMSerializer |
asDOMSerializer()
Return a DOMSerializer interface into this serializer.
|
void |
attributeDecl(String eName,
String aName,
String type,
String valueDefault,
String value)
Report an attribute type declaration. |
boolean |
canConvert(char ch)
Tell if this character can be written without escaping. |
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. |
protected boolean |
childNodesWereAdded()
Tell if child nodes have been added to the current element. |
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 |
elementDecl(String name,
String model)
Report an element type declaration. |
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(String namespaceURI,
String localName,
String name)
Receive notification of the end of an element. |
void |
endEntity(String name)
Report the end of an entity. |
void |
endNonEscaping()
Ends an un-escaping section. |
void |
endPrefixMapping(String prefix)
End the scope of a prefix-URI Namespace mapping. |
void |
endPreserving()
Ends a whitespace preserving section. |
void |
entityReference(String name)
Receive notivication of a entityReference. |
void |
externalEntityDecl(String name,
String publicId,
String systemId)
Report a parsed external entity declaration. |
void |
flushWriter()
Flush the formatter's result stream. |
Properties |
getOutputFormat()
Returns the output format for this serializer. |
OutputStream |
getOutputStream()
Get the output stream where the events will be serialized to. |
(package private) int |
getURF16SurrogateValue(char c,
char[] ch,
int i,
int end)
Once a surrogate has been detected, get the pair as a single integer value. |
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(OutputStream output,
Properties format)
Initialize the serializer with the specified output stream and output format. |
void |
init(Writer writer,
Properties format)
Initialize the serializer with the specified writer and output format. |
private void |
init(Writer writer,
Properties format,
boolean shouldFlush)
Initialize the serializer with the specified writer and output format. |
void |
internalEntityDecl(String name,
String value)
Report an internal entity declaration. |
protected boolean |
isCDataSection()
Tell if the characters in the current state should be put in cdata section blocks. |
protected boolean |
isEscapingDisabled()
Tell if the character escaping should be disabled for the current state. |
(package private) static boolean |
isUTF16Surrogate(char c)
Return true if the character is the high member of a surrogate pair. |
protected void |
openElementForChildren()
Flag the current element as not yet having any children. |
(package private) void |
outputDocTypeDecl(String name,
boolean closeDecl)
Output the doc type declaration. |
(package private) void |
outputEntityDecl(String name,
String value)
Output the doc type declaration. |
protected void |
outputLineSep()
Output a system-dependent line break. |
void |
printSpace(int n)
Prints n spaces. |
protected void |
processAttribute(String name,
String value)
Process an attribute. |
void |
processingInstruction(String target,
String data)
Receive notification of a processing instruction. |
protected void |
pushState(String namespaceURI,
String localName,
Vector qnames,
BoolStack state)
Push a boolean state based on if the name of the element is found in the list of qnames. |
boolean |
reset()
Resets the serializer. |
void |
serialize(org.w3c.dom.Node node)
Serializes the DOM node. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Receive an object for locating the origin of SAX document events. |
void |
setOutputFormat(Properties format)
Specifies an output format for this serializer. |
void |
setOutputStream(OutputStream output)
Specifies an output stream to which the document should be serialized. |
void |
setWriter(Writer writer)
Specifies a writer to which the document should be serialized. |
protected boolean |
shouldIndent()
Tell if, based on space preservation constraints and the doIndent property, if an indent should occur. |
void |
skippedEntity(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(String name,
String publicId,
String systemId)
Report the start of DTD declarations, if any. |
void |
startElement(String namespaceURI,
String localName,
String name,
org.xml.sax.Attributes atts)
Receive notification of the beginning of an element. |
void |
startEntity(String name)
Report the beginning of an entity. |
void |
startNonEscaping()
Starts an un-escaping section. |
void |
startPrefixMapping(String prefix,
String uri)
Begin the scope of a prefix-URI Namespace mapping. |
void |
startPreserving()
Starts a whitespace preserving section. |
protected static boolean |
subPartMatch(String p,
String t)
Tell if two strings are equal, without worry if the first string is null. |
void |
writeAttrString(String string,
String encoding)
Returns the specified string after substituting specials, and UTF-16 surrogates for chracter references &#xnn . |
(package private) void |
writeNormalizedChars(char[] ch,
int start,
int length,
boolean isCData)
Normalize the characters, but don't escape. |
protected void |
writeParentTagEnd()
Check to see if a parent's ">" has been written, and, if it has not, write it. |
protected int |
writeUTF16Surrogate(char c,
char[] ch,
int i,
int end)
Once a surrogate has been detected, write the pair as a single character reference. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Writer m_writer
boolean m_shouldFlush
protected String m_encoding
static boolean javaEncodingIsISO
public boolean m_shouldNotWriteXMLHeader
public String m_version
protected BoolStack m_elemStack
protected BoolStack m_disableOutputEscapingStates
protected BoolStack m_cdataSectionStates
protected Vector m_cdataSectionNames
protected boolean m_inCData
protected final char[] m_lineSep
protected final int m_lineSepLen
protected boolean m_ispreserve
protected BoolStack m_preserves
protected boolean m_isprevtext
protected boolean m_doIndent
protected int m_currentIndent
public int m_indentAmount
protected int level
boolean m_startNewLine
boolean m_needToOutputDocTypeDecl
String m_doctypeSystem
String m_doctypePublic
boolean m_standalone
boolean m_standaloneWasSpecified
String m_mediatype
protected boolean m_inEntityRef
private boolean m_inDoctype
protected static CharInfo m_xmlcharInfo
protected CharInfo m_charInfo
private static Hashtable m_charInfos
boolean m_isUTF8
protected int m_maxCharacter
public boolean m_spaceBeforeClose
protected Properties m_format
private static final boolean DEBUG
private boolean m_inExternalDTD
protected int m_pos
private String m_elemName
Object m_charToByteConverter
Method m_canConvertMeth
boolean m_triedToGetConverter
Constructor Detail |
public SerializerToXML()
Method Detail |
protected boolean isEscapingDisabled()
protected boolean isCDataSection()
protected final void outputLineSep() throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void CopyFrom(SerializerToXML xmlListener)
xmlListener
- non-null reference to a SerializerToXML object.public void init(Writer writer, Properties format)
writer
- The writer to useformat
- The output formatprivate void init(Writer writer, Properties format, boolean shouldFlush)
writer
- The writer to useformat
- The output formatshouldFlush
- True if the writer should be flushed at EndDocument.public void init(OutputStream output, Properties format) throws UnsupportedEncodingException
output
- The output stream to useformat
- The output format
UnsupportedEncodingException
- The encoding specified
in the output format is not supportedpublic void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator
in interface org.xml.sax.ContentHandler
locator
- An object that can return the location of
any SAX document event.Locator
void outputDocTypeDecl(String name, boolean closeDecl) throws org.xml.sax.SAXException
name
- non-null reference to document type name.
NEEDSDOC @param closeDecl
org.xml.sax.SAXException
void outputEntityDecl(String name, String value) throws org.xml.sax.SAXException
name
- non-null reference to document type name.
NEEDSDOC @param value
org.xml.sax.SAXException
public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
public void startDTD(String name, String publicId, String systemId) throws org.xml.sax.SAXException
startDTD
in interface org.xml.sax.ext.LexicalHandler
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.
org.xml.sax.SAXException
- The application may raise an
exception.endDTD()
,
startEntity(java.lang.String)
public void endDTD() throws org.xml.sax.SAXException
endDTD
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException
startPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException
endPrefixMapping
in interface org.xml.sax.ContentHandler
prefix
- The prefix that was being mapping.
org.xml.sax.SAXException
- The client may throw
an exception during processing.ContentHandler.endPrefixMapping(java.lang.String)
protected static final boolean subPartMatch(String p, String t)
p
- String reference, which may be null.t
- String reference, which may be null.
protected void pushState(String namespaceURI, String localName, Vector qnames, BoolStack state)
namespaceURI
- Should be a non-null reference to the namespace URL
of the element that owns the state, or empty string.localName
- Should be a non-null reference to the local name
of the element that owns the state.qnames
- Vector of qualified names of elements, or null.state
- The stack where the state should be pushed.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
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.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
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
protected void writeParentTagEnd() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void openElementForChildren()
protected boolean childNodesWereAdded()
public void endElement(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
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
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
protected void processAttribute(String name, String value) throws org.xml.sax.SAXException
name
- The name of the attribute.value
- The value of the attribute.
org.xml.sax.SAXException
public void startNonEscaping() throws org.xml.sax.SAXException
The contents of the un-escaping section will be delivered through the regular characters event.
org.xml.sax.SAXException
public void endNonEscaping() throws org.xml.sax.SAXException
org.xml.sax.SAXException
startNonEscaping()
public void startPreserving() throws org.xml.sax.SAXException
The contents of the whitespace preserving section will be delivered through the regular characters event.
org.xml.sax.SAXException
public void endPreserving() throws org.xml.sax.SAXException
org.xml.sax.SAXException
startPreserving()
public void processingInstruction(String target, String data) throws org.xml.sax.SAXException
processingInstruction
in interface org.xml.sax.ContentHandler
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 comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
comment
in interface org.xml.sax.ext.LexicalHandler
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.
org.xml.sax.SAXException
- The application may raise an exception.public void startCDATA() throws org.xml.sax.SAXException
startCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.endCDATA()
public void endCDATA() throws org.xml.sax.SAXException
endCDATA
in interface org.xml.sax.ext.LexicalHandler
org.xml.sax.SAXException
- The application may raise an exception.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.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.
org.xml.sax.SAXException
ignorableWhitespace(char[], int, int)
,
Locator
protected final void accum(char b) throws org.xml.sax.SAXException
b
- byte to be written to result stream.
org.xml.sax.SAXException
protected final void accum(char[] chars, int start, int length) throws org.xml.sax.SAXException
chars
- non-null reference to character array.start
- Start of characters to be written.length
- Number of characters to be written.
org.xml.sax.SAXException
protected final void accum(String s) throws org.xml.sax.SAXException
s
- non-null reference to string to be written to the character buffer.
org.xml.sax.SAXException
public final void flushWriter() throws org.xml.sax.SAXException
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
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
ignorableWhitespace(char[], int, int)
,
Locator
public void charactersRaw(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.
org.xml.sax.SAXException
static final boolean isUTF16Surrogate(char c)
int getURF16SurrogateValue(char c, char[] ch, int i, int end) throws org.xml.sax.SAXException
c
- the first part of the surrogate.ch
- Character array.i
- position Where the surrogate was detected.end
- The end index of the significant characters.
org.xml.sax.SAXException
- if invalid UTF-16 surrogate detected.protected int writeUTF16Surrogate(char c, char[] ch, int i, int end) throws IOException, org.xml.sax.SAXException
c
- the first part of the surrogate.ch
- Character array.i
- position Where the surrogate was detected.end
- The end index of the significant characters.
IOException
org.xml.sax.SAXException
- if invalid UTF-16 surrogate detected.void writeNormalizedChars(char[] ch, int start, int length, boolean isCData) throws IOException, 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.isCData
- true if a CDATA block should be built around the characters.
IOException
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
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
characters(char[], int, int)
public void skippedEntity(String name) throws org.xml.sax.SAXException
skippedEntity
in interface org.xml.sax.ContentHandler
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]".
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.skippedEntity(java.lang.String)
public void startEntity(String name) throws org.xml.sax.SAXException
startEntity
in interface org.xml.sax.ext.LexicalHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.
org.xml.sax.SAXException
- The application may raise an exception.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(String name) throws org.xml.sax.SAXException
endEntity
in interface org.xml.sax.ext.LexicalHandler
name
- The name of the entity that is ending.
org.xml.sax.SAXException
- The application may raise an exception.startEntity(java.lang.String)
public void entityReference(String name) throws org.xml.sax.SAXException
name
- The name of the entity.
org.xml.sax.SAXException
public void elementDecl(String name, String model) throws org.xml.sax.SAXException
The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all whitespace is removed,and will include the enclosing parentheses.
elementDecl
in interface org.xml.sax.ext.DeclHandler
name
- The element type name.model
- The content model as a normalized string.
org.xml.sax.SAXException
- The application may raise an exception.public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) throws org.xml.sax.SAXException
Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION", or a parenthesized token group with the separator "|" and all whitespace removed.
attributeDecl
in interface org.xml.sax.ext.DeclHandler
eName
- The name of the associated element.aName
- The name of the attribute.type
- A string representing the attribute type.valueDefault
- A string representing the attribute default
("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
none of these applies.value
- A string representing the attribute's default value,
or null if there is none.
org.xml.sax.SAXException
- The application may raise an exception.public void internalEntityDecl(String name, String value) throws org.xml.sax.SAXException
Only the effective (first) declaration for each entity will be reported.
internalEntityDecl
in interface org.xml.sax.ext.DeclHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.value
- The replacement text of the entity.
org.xml.sax.SAXException
- The application may raise an exception.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void externalEntityDecl(String name, String publicId, String systemId) throws org.xml.sax.SAXException
Only the effective (first) declaration for each entity will be reported.
externalEntityDecl
in interface org.xml.sax.ext.DeclHandler
name
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.publicId
- The declared public identifier of the entity, or
null if none was declared.systemId
- The declared system identifier of the entity.
org.xml.sax.SAXException
- The application may raise an exception.internalEntityDecl(java.lang.String, java.lang.String)
,
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
protected int accumDefaultEntity(char ch, int i, char[] chars, int len, boolean escLF) throws org.xml.sax.SAXException
ch
- character to be escaped.i
- index into character array.chars
- non-null reference to character array.len
- length of chars.escLF
- true if the linefeed should be escaped.
org.xml.sax.SAXException
protected int accumDefaultEscape(char ch, int i, char[] chars, int len, boolean escLF) throws org.xml.sax.SAXException
ch
- character to be escaped.i
- index into character array.chars
- non-null reference to character array.len
- length of chars.escLF
- true if the linefeed should be escaped.
org.xml.sax.SAXException
public boolean canConvert(char ch)
public void writeAttrString(String string, String encoding) throws org.xml.sax.SAXException
&#xnn
.
string
- String to convert to XML format.encoding
- CURRENTLY NOT IMPLEMENTED.
org.xml.sax.SAXException
protected boolean shouldIndent()
public void printSpace(int n) throws org.xml.sax.SAXException
n
- Number of spaces to print.
org.xml.sax.SAXException
- if an error occurs when writing.public void indent(int n) throws org.xml.sax.SAXException
n
- Number of spaces to print.
org.xml.sax.SAXException
- if an error occurs during writing.public void setOutputStream(OutputStream output)
The encoding specified in the output properties is used, or if no encoding was specified, the default for the selected output method.
setOutputStream
in interface Serializer
output
- The output streampublic OutputStream getOutputStream()
getOutputStream
in interface Serializer
public void setWriter(Writer writer)
setWriter
in interface Serializer
writer
- The output writer streampublic Writer getWriter()
getWriter
in interface Serializer
public void setOutputFormat(Properties format)
setOutputFormat
in interface Serializer
format
- The output format to usepublic Properties getOutputFormat()
getOutputFormat
in interface Serializer
public org.xml.sax.ContentHandler asContentHandler() throws IOException
ContentHandler
interface into this serializer.
If the serializer does not support the ContentHandler
interface, it should return null.
asContentHandler
in interface Serializer
ContentHandler
interface into this serializer,
or null if the serializer is not SAX 2 capable
IOException
- An I/O exception occuredpublic DOMSerializer asDOMSerializer() throws IOException
DOMSerializer
interface into this serializer.
If the serializer does not support the DOMSerializer
interface, it should return null.
asDOMSerializer
in interface Serializer
DOMSerializer
interface into this serializer,
or null if the serializer is not DOM capable
IOException
- An I/O exception occuredpublic boolean reset()
reset
in interface Serializer
public void serialize(org.w3c.dom.Node node) throws IOException
serialize
in interface DOMSerializer
node
- Node to serialize.
IOException
- An I/O exception occured while serializing
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |