APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.serializer

public final Class ToXMLSAXHandler

extends ToSAXHandler
Class Inheritance
Imports
java.io.IOException, .OutputStream, .Writer, java.util.Properties, javax.xml.transform.Result, org.w3c.dom.Node, org.xml.sax.Attributes, .ContentHandler, .Locator, .SAXException, org.xml.sax.ext.LexicalHandler

This class receives notification of SAX-like events, and with gathered information over these calls it will invoke the equivalent SAX methods on a handler, the ultimate xsl:output method is known to be "xml". This class is not a public API, it is only public because it is used by Xalan.

Field Summary

Modifier and TypeField and Description
protected boolean
m_escapeSetting

Keeps track of whether output escaping is currently enabled

Inherited from com.sun.org.apache.xml.internal.serializer.ToSAXHandler:
m_lexHandlerm_saxHandlerm_state

Constructor Summary

AccessConstructor and Description
public
public
public

Method Summary

Modifier and TypeMethod and Description
public void
addAttribute(String
the URI of the attribute
uri
,
String
the local name of the attribute
localName
,
String
the qualified name of the attribute
rawName
,
String
the type of the attribute (probably CDATA)
type
,
String
the value of the attribute
value
,
boolean
true if this attribute is coming from an xsl:attribute element
XSLAttribute
)

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.addAttribute.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.addAttribute.

Adds the given attribute to the set of attributes, and also makes sure that the needed prefix/uri mapping is declared, but only if there is a currently open element.

public void
attributeDecl(String arg0, String arg1, String arg2, String arg3, String arg4)

Implements org.xml.sax.ext.DeclHandler.attributeDecl.

Report an attribute type declaration.

public void
public void
characters(char[] ch, int off, int len)

Implements org.xml.sax.ContentHandler.characters.

Receive notification of character data.

public void
closeCDATA()

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.closeCDATA.

Closes ane open cdata tag, and unlike the this.endCDATA() method (from the LexicalHandler) interface, this "internal" method will send the endCDATA() call to the wrapped handler.

protected void
closeStartTag()

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.closeStartTag.

This method is called when all the data needed for a call to the SAX handler's startElement() method has been gathered.

public void
comment(char[] arg0, int arg1, int arg2)

Implements org.xml.sax.ext.LexicalHandler.comment.

Report an XML comment anywhere in the document.

public void
elementDecl(String arg0, String arg1)

Implements org.xml.sax.ext.DeclHandler.elementDecl.

Report an element type declaration.

public void
endCDATA()

Implements org.xml.sax.ext.LexicalHandler.endCDATA.

Report the end of a CDATA section.

public void
endDocument()

Implements org.xml.sax.ContentHandler.endDocument.

Receives notification of the end of the document.

public void
endDTD()

Implements org.xml.sax.ext.LexicalHandler.endDTD.

Report the end of DTD declarations.

public void
endElement(String namespaceURI, String localName, String qName)

Implements org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

public void
endElement(String elemName)

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.endElement.

This method is used to notify that an element has ended.

public void
endPrefixMapping(String prefix)

Implements org.xml.sax.ContentHandler.endPrefixMapping.

End the scope of a prefix-URI mapping.

private void
public void
externalEntityDecl(String arg0, String arg1, String arg2)

Implements org.xml.sax.ext.DeclHandler.externalEntityDecl.

Report a parsed external entity declaration.

public Properties
getOutputFormat()

Implements com.sun.org.apache.xml.internal.serializer.Serializer.getOutputFormat.

Returns the output format properties for this serializer.

public OutputStream
getOutputStream()

Implements com.sun.org.apache.xml.internal.serializer.Serializer.getOutputStream.

Get the output stream where the events will be serialized to.

public Writer
getWriter()

Implements com.sun.org.apache.xml.internal.serializer.Serializer.getWriter.

Get the character stream where the events will be serialized to.

public void
ignorableWhitespace(char[] arg0, int arg1, int arg2)

Implements org.xml.sax.ContentHandler.ignorableWhitespace.

Receive notification of ignorable whitespace in element content.

public void
indent(int n)

Do nothing for SAX.

public void
internalEntityDecl(String arg0, String arg1)

Implements org.xml.sax.ext.DeclHandler.internalEntityDecl.

Report an internal entity declaration.

public void
protected boolean
popNamespace(String prefix)

Undeclare the namespace that is currently pointed to by a given prefix.

public void
public boolean

Returns:

true if the class was successfuly reset.
reset
()

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.reset.

Implements com.sun.org.apache.xml.internal.serializer.Serializer.reset.

Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons).

private void
resetToXMLSAXHandler()

Reset all of the fields owned by ToXMLSAXHandler class

public void
serialize(Node node)

Implements com.sun.org.apache.xml.internal.serializer.SerializationHandler.serialize.

Notify that the serializer should take this DOM node as input to be serialized.

public void
setDocumentLocator(Locator arg0)

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.setDocumentLocator.

Implements org.xml.sax.ContentHandler.setDocumentLocator.

Receive an object for locating the origin of SAX document events.

public boolean
setEscaping(boolean escape)

Implements com.sun.org.apache.xml.internal.serializer.SerializationHandler.setEscaping.

Turns special character escaping on/off.

public void
setOutputFormat(Properties format)

Implements com.sun.org.apache.xml.internal.serializer.Serializer.setOutputFormat.

Specifies an output format for this serializer.

public void
setOutputStream(OutputStream output)

Implements com.sun.org.apache.xml.internal.serializer.Serializer.setOutputStream.

Specifies an output stream to which the document should be serialized.

public void
setWriter(Writer writer)

Implements com.sun.org.apache.xml.internal.serializer.Serializer.setWriter.

Specifies a writer to which the document should be serialized.

public void
skippedEntity(String arg0)

Implements org.xml.sax.ContentHandler.skippedEntity.

Receive notification of a skipped entity.

public void
startCDATA()

Implements org.xml.sax.ext.LexicalHandler.startCDATA.

Report the start of a CDATA section.

public void
startElement(String elementNamespaceURI, String elementLocalName, String elementName)

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.startElement.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.startElement.

Start an element in the output document.</elem>

public void
public void
startElement(String namespaceURI, String localName, String name, Attributes atts)

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Receive notification of the beginning of an element, although this is a SAX method additional namespace or attribute information can occur before or after this call, that is associated with this element.

public void
startEntity(String arg0)

Implements org.xml.sax.ext.LexicalHandler.startEntity.

Report the beginning of some internal and external XML entities.

public void
startPrefixMapping(String
The prefix that maps to the URI
prefix
,
String
The URI for the namespace
uri
)

Implements org.xml.sax.ContentHandler.startPrefixMapping.

Begin the scope of a prefix-URI Namespace mapping.

public boolean
startPrefixMapping(String
The prefix that maps to the URI
prefix
,
String
The URI for the namespace
uri
,
boolean
a flag indicating if the mapping applies to the current element or an up coming child (not used).
shouldFlush
)

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.startPrefixMapping.

Remember the prefix/uri mapping at the current nested element depth.

Inherited from com.sun.org.apache.xml.internal.serializer.ToSAXHandler:
addUniqueAttributecharacterscommenterrorfatalErrorflushPendinggetShouldOutputNSAttrsetCdataSectionElementssetContentHandlersetLexHandlersetShouldOutputNSAttrsetTransformStatestartDocumentInternalstartDTDwarning

Field Detail

m_escapeSettingback to summary
protected boolean m_escapeSetting

Keeps track of whether output escaping is currently enabled

Constructor Detail

ToXMLSAXHandlerback to summary
public ToXMLSAXHandler()
ToXMLSAXHandlerback to summary
public ToXMLSAXHandler(ContentHandler handler, String encoding)
ToXMLSAXHandlerback to summary
public ToXMLSAXHandler(ContentHandler handler, LexicalHandler lex, String encoding)

Method Detail

addAttributeback to summary
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.addAttribute.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.addAttribute.

Adds the given attribute to the set of attributes, and also makes sure that the needed prefix/uri mapping is declared, but only if there is a currently open element.

Parameters
uri:String

the URI of the attribute

localName:String

the local name of the attribute

rawName:String

the qualified name of the attribute

type:String

the type of the attribute (probably CDATA)

value:String

the value of the attribute

XSLAttribute:boolean

true if this attribute is coming from an xsl:attribute element

See Also
ExtendedContentHandler#addAttribute(String, String, String, String, String)
attributeDeclback to summary
public void attributeDecl(String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException

Implements org.xml.sax.ext.DeclHandler.attributeDecl.

Doc from org.xml.sax.ext.DeclHandler.attributeDecl.

Report an attribute type declaration.

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", a parenthesized token group with the separator "|" and all whitespace removed, or the word "NOTATION" followed by a space followed by a parenthesized token group with all whitespace removed.

The value will be the value as reported to applications, appropriately normalized and with entity and character references expanded.

Exceptions
SAXException:
The application may raise an exception.
See Also
org.xml.sax.ext.DeclHandler#attributeDecl(String, String, String, String, String)
charactersback to summary
public void characters(String chars) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.characters.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.characters.

Doc from com.sun.org.apache.xml.internal.serializer.ToSAXHandler.characters.

Receive notification of character data.

See Also
ExtendedContentHandler#characters(String)
charactersback to summary
public void characters(char[] ch, int off, int len) throws SAXException

Implements org.xml.sax.ContentHandler.characters.

Doc from org.xml.sax.ContentHandler.characters.

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.

Individual characters may consist of more than one Java char value. There are two important cases where this happens, because characters can't be represented in just sixteen bits. In one case, characters are represented in a Surrogate Pair, using two special Unicode values. Such characters are in the so-called "Astral Planes", with a code point above U+FFFF. A second case involves composite characters, such as a base character combining with one or more accent characters.

Your code should not assume that algorithms using char-at-a-time idioms will be working in character units; in some cases they will split characters. This is relevant wherever XML permits arbitrary characters, such as attribute values, processing instruction data, and comments as well as in data reported from this method. It's also generally relevant whenever Java code manipulates internationalized text; the issue isn't unique to XML.

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

Exceptions
SAXException:
any SAX exception, possibly wrapping another exception
closeCDATAback to summary
public void closeCDATA() throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.closeCDATA.

Closes ane open cdata tag, and unlike the this.endCDATA() method (from the LexicalHandler) interface, this "internal" method will send the endCDATA() call to the wrapped handler.

closeStartTagback to summary
protected void closeStartTag() throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.closeStartTag.

This method is called when all the data needed for a call to the SAX handler's startElement() method has been gathered.

commentback to summary
public void comment(char[] arg0, int arg1, int arg2) throws SAXException

Implements org.xml.sax.ext.LexicalHandler.comment.

Doc from org.xml.sax.ext.LexicalHandler.comment.

Report an XML comment anywhere in the document.

This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read). Comments in the DTD must be properly nested inside start/endDTD and start/endEntity events (if used).

Exceptions
SAXException:
The application may raise an exception.
See Also
org.xml.sax.ext.LexicalHandler#comment(char[], int, int)
elementDeclback to summary
public void elementDecl(String arg0, String arg1) throws SAXException

Implements org.xml.sax.ext.DeclHandler.elementDecl.

Doc from org.xml.sax.ext.DeclHandler.elementDecl.

Report an element type declaration.

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 parameter entities are fully resolved and all whitespace is removed, and will include the enclosing parentheses. Other normalization (such as removing redundant parentheses or simplifying occurrence indicators) is at the discretion of the parser.

Exceptions
SAXException:
The application may raise an exception.
See Also
org.xml.sax.ext.DeclHandler#elementDecl(String, String)
endCDATAback to summary
public void endCDATA() throws SAXException

Implements org.xml.sax.ext.LexicalHandler.endCDATA.

Doc from org.xml.sax.ext.LexicalHandler.endCDATA.

Report the end of a CDATA section.

Exceptions
SAXException:
The application may raise an exception.
See Also
org.xml.sax.ext.LexicalHandler#endCDATA()
endDocumentback to summary
public void endDocument() throws SAXException

Implements org.xml.sax.ContentHandler.endDocument.

Receives notification of the end of the document.

Exceptions
SAXException:

Doc from org.xml.sax.ContentHandler.endDocument.

any SAX exception, possibly wrapping another exception

See Also
org.xml.sax.ContentHandler#endDocument()
endDTDback to summary
public void endDTD() throws SAXException

Implements org.xml.sax.ext.LexicalHandler.endDTD.

Doc from org.xml.sax.ext.LexicalHandler.endDTD.

Report the end of DTD declarations.

This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.

Exceptions
SAXException:
The application may raise an exception.
See Also
org.xml.sax.ext.LexicalHandler#endDTD()
endElementback to summary
public void endElement(String namespaceURI, String localName, String qName) throws SAXException

Implements org.xml.sax.ContentHandler.endElement.

Doc from org.xml.sax.ContentHandler.endElement.

Receive notification of the end of an element.

The SAX parser will invoke this method at the end of every element in the XML document; there will be a corresponding startElement event for every endElement event (even when the element is empty).

For information on the names, see startElement.

Exceptions
SAXException:
any SAX exception, possibly wrapping another exception
See Also
org.xml.sax.ContentHandler#endElement(String, String, String)
endElementback to summary
public void endElement(String elemName) throws SAXException

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.endElement.

Doc from com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.endElement.

This method is used to notify that an element has ended. Unlike the standard SAX method

endElement(namespaceURI,localName,qName)
only the last parameter is passed. If needed the serializer can derive the localName from the qualified name and derive the namespaceURI from its implementation.
See Also
ExtendedContentHandler#endElement(String)
endPrefixMappingback to summary
public void endPrefixMapping(String prefix) throws SAXException

Implements org.xml.sax.ContentHandler.endPrefixMapping.

Doc from org.xml.sax.ContentHandler.endPrefixMapping.

End the scope of a prefix-URI mapping.

See startPrefixMapping for details. These events will always occur immediately after the corresponding endElement event, but the order of endPrefixMapping events is not otherwise guaranteed.

Exceptions
SAXException:
the client may throw an exception during processing
See Also
org.xml.sax.ContentHandler#endPrefixMapping(String)
ensurePrefixIsDeclaredback to summary
private void ensurePrefixIsDeclared(String ns, String rawName) throws SAXException
externalEntityDeclback to summary
public void externalEntityDecl(String arg0, String arg1, String arg2) throws SAXException

Implements org.xml.sax.ext.DeclHandler.externalEntityDecl.

Doc from org.xml.sax.ext.DeclHandler.externalEntityDecl.

Report a parsed external entity declaration.

Only the effective (first) declaration for each entity will be reported.

If the system identifier is a URL, the parser must resolve it fully before passing it to the application.

Exceptions
SAXException:
The application may raise an exception.
See Also
org.xml.sax.ext.DeclHandler#externalEntityDecl(String, String, String)
getOutputFormatback to summary
public Properties getOutputFormat()

Implements com.sun.org.apache.xml.internal.serializer.Serializer.getOutputFormat.

Doc from com.sun.org.apache.xml.internal.serializer.Serializer.getOutputFormat.

Returns the output format properties for this serializer.

See Also
Serializer#getOutputFormat()
getOutputStreamback to summary
public OutputStream getOutputStream()

Implements com.sun.org.apache.xml.internal.serializer.Serializer.getOutputStream.

Doc from com.sun.org.apache.xml.internal.serializer.Serializer.getOutputStream.

Get the output stream where the events will be serialized to.

See Also
Serializer#getOutputStream()
getWriterback to summary
public Writer getWriter()

Implements com.sun.org.apache.xml.internal.serializer.Serializer.getWriter.

Doc from com.sun.org.apache.xml.internal.serializer.Serializer.getWriter.

Get the character stream where the events will be serialized to.

See Also
Serializer#getWriter()
ignorableWhitespaceback to summary
public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException

Implements org.xml.sax.ContentHandler.ignorableWhitespace.

Doc from org.xml.sax.ContentHandler.ignorableWhitespace.

Receive notification of ignorable whitespace in element content.

Validating Parsers must use this method to report each chunk of whitespace in element content (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.

SAX parsers may return all contiguous whitespace 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.

Exceptions
SAXException:
any SAX exception, possibly wrapping another exception
See Also
org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
indentback to summary
public void indent(int n) throws SAXException

Do nothing for SAX.

internalEntityDeclback to summary
public void internalEntityDecl(String arg0, String arg1) throws SAXException

Implements org.xml.sax.ext.DeclHandler.internalEntityDecl.

Doc from org.xml.sax.ext.DeclHandler.internalEntityDecl.

Report an internal entity declaration.

Only the effective (first) declaration for each entity will be reported. All parameter entities in the value will be expanded, but general entities will not.

Exceptions
SAXException:
The application may raise an exception.
See Also
org.xml.sax.ext.DeclHandler#internalEntityDecl(String, String)
namespaceAfterStartElementback to summary
public void namespaceAfterStartElement(final String prefix, final String uri) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.namespaceAfterStartElement.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.namespaceAfterStartElement.

Send a namespace declaration in the output document. The namespace declaration will not be include if the namespace is already in scope with the same prefix.

popNamespaceback to summary
protected boolean popNamespace(String prefix)

Undeclare the namespace that is currently pointed to by a given prefix. Inform SAX handler if prefix was previously mapped.

processingInstructionback to summary
public void processingInstruction(String target, String data) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.processingInstruction.

Implements org.xml.sax.ContentHandler.processingInstruction.

Doc from com.sun.org.apache.xml.internal.serializer.ToSAXHandler.processingInstruction.

Do nothing as this is an abstract class. All subclasses will need to define their behavior if it is different.

Exceptions
SAXException:

Doc from org.xml.sax.ContentHandler.processingInstruction.

any SAX exception, possibly wrapping another exception

See Also
Send a processing instruction to the output document
resetback to summary
public boolean reset()

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.reset.

Implements com.sun.org.apache.xml.internal.serializer.Serializer.reset.

Try's to reset the super class and reset this class for re-use, so that you don't need to create a new serializer (mostly for performance reasons).

Returns:boolean

true if the class was successfuly reset.

See Also
Serializer#reset()
resetToXMLSAXHandlerback to summary
private void resetToXMLSAXHandler()

Reset all of the fields owned by ToXMLSAXHandler class

serializeback to summary
public void serialize(Node node) throws IOException

Implements com.sun.org.apache.xml.internal.serializer.SerializationHandler.serialize.

Doc from com.sun.org.apache.xml.internal.serializer.SerializationHandler.serialize.

Notify that the serializer should take this DOM node as input to be serialized.

Exceptions
IOException:

Doc from com.sun.org.apache.xml.internal.serializer.DOMSerializer.serialize.

if an I/O exception occured while serializing

See Also
DOMSerializer#serialize(Node)
setDocumentLocatorback to summary
public void setDocumentLocator(Locator arg0)

Overrides com.sun.org.apache.xml.internal.serializer.SerializerBase.setDocumentLocator.

Implements org.xml.sax.ContentHandler.setDocumentLocator.

Doc from com.sun.org.apache.xml.internal.serializer.SerializerBase.setDocumentLocator.

Receive an object for locating the origin of SAX document events.

See Also
org.xml.sax.ContentHandler#setDocumentLocator(Locator)
setEscapingback to summary
public boolean setEscaping(boolean escape) throws SAXException

Implements com.sun.org.apache.xml.internal.serializer.SerializationHandler.setEscaping.

Doc from com.sun.org.apache.xml.internal.serializer.SerializationHandler.setEscaping.

Turns special character escaping on/off. Note that characters will never, even if this option is set to 'true', be escaped within CDATA sections in output XML documents.

See Also
SerializationHandler#setEscaping(boolean)
setOutputFormatback to summary
public void setOutputFormat(Properties format)

Implements com.sun.org.apache.xml.internal.serializer.Serializer.setOutputFormat.

Doc from com.sun.org.apache.xml.internal.serializer.Serializer.setOutputFormat.

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.

The standard property keys supported are: "method", "version", "encoding", "omit-xml-declaration", "standalone", doctype-public", "doctype-system", "cdata-section-elements", "indent", "media-type". These property keys and their values are described in the XSLT recommendation, see href="http://www.w3.org/TR/1999/REC-xslt-19991116"> XSLT 1.0 recommendation</a>

The non-standard property keys supported are defined in OutputPropertiesFactory.

This method can be called multiple times before a document is serialized. Each time it is called more, or over-riding property values, can be specified. One property value that can not be changed is that of the "method" property key.

The value of the "cdata-section-elements" property key is a whitespace separated list of elements. If the element is in a namespace then value is passed in this format: {uri}localName

If the "cdata-section-elements" key is specified on multiple calls to this method the set of elements specified in the value is not replaced from one call to the next, but it is cumulative across the calls.

See Also
Serializer#setOutputFormat(Properties)
setOutputStreamback to summary
public void setOutputStream(OutputStream output)

Implements com.sun.org.apache.xml.internal.serializer.Serializer.setOutputStream.

Doc from com.sun.org.apache.xml.internal.serializer.Serializer.setOutputStream.

Specifies an output stream to which the document should be serialized. This method should not be called while the serializer is in the process of serializing a document.

The encoding specified in the output Properties is used, or if no encoding was specified, the default for the selected output method.

Only one of setWriter() or setOutputStream() should be called.

See Also
Serializer#setOutputStream(OutputStream)
setWriterback to summary
public void setWriter(Writer writer)

Implements com.sun.org.apache.xml.internal.serializer.Serializer.setWriter.

Doc from com.sun.org.apache.xml.internal.serializer.Serializer.setWriter.

Specifies a writer to which the document should be serialized. This method should not be called while the serializer is in the process of serializing a document.

The encoding specified for the output Properties must be identical to the output format used with the writer.

Only one of setWriter() or setOutputStream() should be called.

See Also
Serializer#setWriter(Writer)
skippedEntityback to summary
public void skippedEntity(String arg0) throws SAXException

Implements org.xml.sax.ContentHandler.skippedEntity.

Doc from org.xml.sax.ContentHandler.skippedEntity.

Receive notification of a skipped entity. This is not called for entity references within markup constructs such as element start tags or markup declarations. (The XML recommendation requires reporting skipped external entities. SAX also reports internal entity expansion/non-expansion, except within markup constructs.)

The Parser will invoke this method each time the entity is skipped. Non-validating processors may skip entities if they have not seen the declarations (because, for example, the entity was declared in an external DTD subset). All processors may skip external entities, depending on the values of the http://xml.org/sax/features/external-general-entities and the http://xml.org/sax/features/external-parameter-entities properties.

Exceptions
SAXException:
any SAX exception, possibly wrapping another exception
See Also
org.xml.sax.ContentHandler#skippedEntity(String)
startCDATAback to summary
public void startCDATA() throws SAXException

Implements org.xml.sax.ext.LexicalHandler.startCDATA.

Doc from org.xml.sax.ext.LexicalHandler.startCDATA.

Report the start of a CDATA section.

The contents of the CDATA section will be reported through the regular characters event; this event is intended only to report the boundary.

Exceptions
SAXException:
The application may raise an exception.
startElementback to summary
public void startElement(String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.startElement.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.startElement.

Start an element in the output document. This might be an XML element (data type) or a CDATA section.

startElementback to summary
public void startElement(String elementName) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.startElement.

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.startElement.

Doc from com.sun.org.apache.xml.internal.serializer.ToSAXHandler.startElement.

An element starts, but attributes are not fully known yet.

startElementback to summary
public void startElement(String namespaceURI, String localName, String name, Attributes atts) throws SAXException

Overrides com.sun.org.apache.xml.internal.serializer.ToSAXHandler.startElement.

Implements org.xml.sax.ContentHandler.startElement.

Doc from com.sun.org.apache.xml.internal.serializer.ToSAXHandler.startElement.

Receive notification of the beginning of an element, although this is a SAX method additional namespace or attribute information can occur before or after this call, that is associated with this element.

Exceptions
SAXException:
Any SAX exception, possibly wrapping another exception.
See Also
org.xml.sax.ContentHandler#startElement(String, String, String, Attributes)
startEntityback to summary
public void startEntity(String arg0) throws SAXException

Implements org.xml.sax.ext.LexicalHandler.startEntity.

Doc from org.xml.sax.ext.LexicalHandler.startEntity.

Report the beginning of some internal and external XML entities.

The reporting of parameter entities (including the external DTD subset) is optional, and SAX2 drivers that report LexicalHandler events may not implement it; you can use the http://xml.org/sax/features/lexical-handler/parameter-entities feature to query or control the reporting of parameter entities.

General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]".

When a SAX2 driver is providing these events, all other events must be properly nested within start/end entity events. There is no additional requirement that events from DeclHandler or DTDHandler be properly ordered.

Note that skipped entities will be reported through the skippedEntity event, which is part of the ContentHandler interface.

Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:

  • general entities within attribute values
  • parameter entities within declarations

These will be silently expanded, with no indication of where the original entity boundaries were.

Note also that the boundaries of character references (which are not really entities anyway) are not reported.

All start/endEntity events must be properly nested.

Exceptions
SAXException:
The application may raise an exception.
See Also
org.xml.sax.ext.LexicalHandler#startEntity(String)
startPrefixMappingback to summary
public void startPrefixMapping(String prefix, String uri) throws SAXException

Implements org.xml.sax.ContentHandler.startPrefixMapping.

Doc from org.xml.sax.ContentHandler.startPrefixMapping.

Begin the scope of a prefix-URI Namespace mapping.

The information from this event is not necessary for normal Namespace processing: the SAX XML reader will automatically replace prefixes for element and attribute names when the http://xml.org/sax/features/namespaces feature is true (the default).

There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary.

Note that start/endPrefixMapping events are not guaranteed to be properly nested relative to each other: all startPrefixMapping events will occur immediately before the corresponding startElement event, and all endPrefixMapping events will occur immediately after the corresponding endElement event, but their order is not otherwise guaranteed.

There should never be start/endPrefixMapping events for the "xml" prefix, since it is predeclared and immutable.

Parameters
prefix:String

The prefix that maps to the URI

uri:String

The URI for the namespace

Exceptions
SAXException:
the client may throw an exception during processing
See Also
org.xml.sax.ContentHandler#startPrefixMapping(String, String)
startPrefixMappingback to summary
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException

Implements com.sun.org.apache.xml.internal.serializer.ExtendedContentHandler.startPrefixMapping.

Remember the prefix/uri mapping at the current nested element depth.

Parameters
prefix:String

The prefix that maps to the URI

uri:String

The URI for the namespace

shouldFlush:boolean

a flag indicating if the mapping applies to the current element or an up coming child (not used).

See Also
org.xml.sax.ContentHandler#startPrefixMapping(String, String)