|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.xml.serializer.EmptySerializer
public class EmptySerializer
This class is an adapter class. Its only purpose is to be extended and for that extended class to over-ride all methods that are to be used.
Field Summary |
---|
Fields inherited from interface org.apache.xml.serializer.ExtendedContentHandler |
---|
HTML_ATTREMPTY, HTML_ATTRURL, NO_BAD_CHARS |
Constructor Summary | |
---|---|
EmptySerializer()
|
Method Summary | |
---|---|
void |
addAttribute(java.lang.String name,
java.lang.String value)
Add an attribute to the current element. |
void |
addAttribute(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
java.lang.String type,
java.lang.String value)
Add at attribute to the current element |
void |
addAttributes(Attributes atts)
Add attributes to the current element |
void |
addUniqueAttribute(java.lang.String name,
java.lang.String value,
int flags)
Add a unique attribute to the current element. |
ContentHandler |
asContentHandler()
Return a ContentHandler interface into this serializer. |
DOMSerializer |
asDOMSerializer()
Return a DOMSerializer interface into this serializer. |
void |
attributeDecl(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2,
java.lang.String arg3,
java.lang.String arg4)
Report an attribute type declaration. |
void |
characters(char[] arg0,
int arg1,
int arg2)
Receive notification of character data. |
void |
characters(java.lang.String chars)
This method is used to notify of a character event, but passing the data as a character String rather than the standard character array. |
void |
close()
|
void |
comment(char[] arg0,
int arg1,
int arg2)
Report an XML comment anywhere in the document. |
void |
comment(java.lang.String comment)
This method is used to notify of a comment |
void |
elementDecl(java.lang.String arg0,
java.lang.String arg1)
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(java.lang.String elemName)
This method is used to notify that an element has ended. |
void |
endElement(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
Receive notification of the end of an element. |
void |
endEntity(java.lang.String arg0)
Report the end of an entity. |
void |
endPrefixMapping(java.lang.String arg0)
End the scope of a prefix-URI mapping. |
void |
entityReference(java.lang.String entityName)
Notify of an entity reference. |
void |
error(SAXParseException arg0)
Receive notification of a recoverable error. |
void |
externalEntityDecl(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
Report a parsed external entity declaration. |
void |
fatalError(SAXParseException arg0)
Receive notification of a non-recoverable error. |
void |
flushPending()
Flush any pending events currently queued up in the serializer. |
java.lang.String |
getDoctypePublic()
Returns the previously set value of the value to be used as the public identifier in the document type declaration (DTD). |
java.lang.String |
getDoctypeSystem()
Returns the previously set value of the value to be used as the system identifier in the document type declaration (DTD). |
java.lang.String |
getEncoding()
|
boolean |
getIndent()
|
int |
getIndentAmount()
|
java.lang.String |
getMediaType()
|
NamespaceMappings |
getNamespaceMappings()
This method returns an object that has the current namespace mappings in effect. |
java.lang.String |
getNamespaceURI(java.lang.String name,
boolean isElement)
This method gets the prefix associated with a current element or attribute name. |
java.lang.String |
getNamespaceURIFromPrefix(java.lang.String prefix)
This method returns the namespace URI currently associated with the prefix. |
boolean |
getOmitXMLDeclaration()
|
java.util.Properties |
getOutputFormat()
Returns the output format properties for this serializer. |
java.io.OutputStream |
getOutputStream()
Get the output stream where the events will be serialized to. |
java.lang.String |
getPrefix(java.lang.String uri)
This method returns the prefix that currently maps to the given namespace URI. |
java.lang.String |
getStandalone()
|
Transformer |
getTransformer()
Get the transformer associated with the serializer. |
java.lang.String |
getVersion()
|
java.io.Writer |
getWriter()
Get the character stream where the events will be serialized to. |
void |
ignorableWhitespace(char[] arg0,
int arg1,
int arg2)
Receive notification of ignorable whitespace in element content. |
void |
internalEntityDecl(java.lang.String arg0,
java.lang.String arg1)
Report an internal entity declaration. |
void |
namespaceAfterStartElement(java.lang.String uri,
java.lang.String prefix)
This method is used to notify that a prefix mapping is to start, but after an element is started. |
void |
processingInstruction(java.lang.String arg0,
java.lang.String arg1)
Receive notification of a processing instruction. |
boolean |
reset()
Resets the serializer. |
void |
serialize(Node node)
Serializes the DOM node. |
void |
setCdataSectionElements(java.util.Hashtable h)
|
void |
setCdataSectionElements(java.util.Vector URI_and_localNames)
Sets the value coming from the xsl:output cdata-section-elements stylesheet property. |
void |
setContentHandler(ContentHandler ch)
Set the SAX Content handler that the serializer sends its output to. |
void |
setDoctype(java.lang.String system,
java.lang.String pub)
Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties |
void |
setDoctypePublic(java.lang.String doctype)
Set the value coming from the xsl:output doctype-public stylesheet attribute. |
void |
setDoctypeSystem(java.lang.String doctype)
Set the value coming from the xsl:output doctype-system stylesheet attribute. |
void |
setDocumentLocator(Locator arg0)
Receive an object for locating the origin of SAX document events. |
void |
setEncoding(java.lang.String encoding)
Sets the character encoding coming from the xsl:output encoding stylesheet attribute. |
boolean |
setEscaping(boolean escape)
Turns special character escaping on/off. |
void |
setIndent(boolean indent)
Sets the value coming from the xsl:output indent stylesheet attribute. |
void |
setIndentAmount(int spaces)
Set the number of spaces to indent for each indentation level. |
void |
setMediaType(java.lang.String mediatype)
Sets the value coming from the xsl:output media-type stylesheet attribute. |
void |
setNamespaceMappings(NamespaceMappings mappings)
Used only by TransformerSnapshotImpl to restore the serialization to a previous state. |
void |
setOmitXMLDeclaration(boolean b)
Sets the value coming from the xsl:output omit-xml-declaration stylesheet attribute |
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 |
setSourceLocator(SourceLocator locator)
This method is used to set the source locator, which might be used to generated an error message. |
void |
setStandalone(java.lang.String standalone)
Sets the value coming from the xsl:output standalone stylesheet attribute. |
void |
setTransformer(Transformer transformer)
Set the transformer associated with the serializer. |
void |
setVersion(java.lang.String version)
Sets the value coming from the xsl:output version attribute. |
void |
setWriter(java.io.Writer writer)
Specifies a writer to which the document should be serialized. |
void |
skippedEntity(java.lang.String arg0)
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 arg0,
java.lang.String arg1,
java.lang.String arg2)
Report the start of DTD declarations, if any. |
void |
startElement(java.lang.String qName)
This method is used to notify of the start of an element |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
This method is used to notify that an element is starting. |
void |
startElement(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2,
Attributes arg3)
Receive notification of the beginning of an element. |
void |
startEntity(java.lang.String arg0)
Report the beginning of some internal and external XML entities. |
void |
startPrefixMapping(java.lang.String arg0,
java.lang.String arg1)
Begin the scope of a prefix-URI Namespace mapping. |
boolean |
startPrefixMapping(java.lang.String prefix,
java.lang.String uri,
boolean shouldFlush)
This method is used to notify that a prefix maping is to start, which can be for the current element, or for the one to come. |
void |
warning(SAXParseException arg0)
Receive notification of a warning. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EmptySerializer()
Method Detail |
---|
public ContentHandler asContentHandler() throws java.io.IOException
Serializer
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
java.io.IOException
- An I/O exception occuredSerializer.asContentHandler()
public void setContentHandler(ContentHandler ch)
SerializationHandler
setContentHandler
in interface SerializationHandler
SerializationHandler.setContentHandler(org.xml.sax.ContentHandler)
public void close()
close
in interface SerializationHandler
SerializationHandler.close()
public java.util.Properties getOutputFormat()
Serializer
getOutputFormat
in interface Serializer
Serializer.getOutputFormat()
public java.io.OutputStream getOutputStream()
Serializer
getOutputStream
in interface Serializer
Serializer.getOutputStream()
public java.io.Writer getWriter()
Serializer
getWriter
in interface Serializer
Serializer.getWriter()
public boolean reset()
Serializer
reset
in interface Serializer
Serializer.reset()
public void serialize(Node node) throws java.io.IOException
DOMSerializer
serialize
in interface DOMSerializer
serialize
in interface SerializationHandler
node
- the DOM node to serialize
java.io.IOException
- if an I/O exception occured while serializingSerializationHandler.serialize(org.w3c.dom.Node)
public void setCdataSectionElements(java.util.Vector URI_and_localNames)
XSLOutputAttributes
setCdataSectionElements
in interface XSLOutputAttributes
URI_and_localNames
- pairs of namespace URI and local names that
identify elements whose text elements are to be output as CDATA sections.
The namespace of the local element must be the given URI to match. The
qName is not given because the prefix does not matter, only the namespace
URI to which that prefix would map matters, so the prefix itself is not
relevant in specifying which elements have their text to be output as
CDATA sections.XSLOutputAttributes.setCdataSectionElements(java.util.Vector)
public boolean setEscaping(boolean escape) throws SAXException
SerializationHandler
setEscaping
in interface SerializationHandler
SAXException
SerializationHandler.setEscaping(boolean)
public void setIndent(boolean indent)
XSLOutputAttributes
setIndent
in interface XSLOutputAttributes
indent
- true if the output document should be indented to visually
indicate its structure.XSLOutputAttributes.setIndent(boolean)
public void setIndentAmount(int spaces)
SerializationHandler
setIndentAmount
in interface SerializationHandler
spaces
- the number of spaces to indent for each indentation level.SerializationHandler.setIndentAmount(int)
public void setOutputFormat(java.util.Properties format)
Serializer
setOutputFormat
in interface Serializer
format
- The output format to useSerializer.setOutputFormat(java.util.Properties)
public void setOutputStream(java.io.OutputStream output)
Serializer
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 streamSerializer.setOutputStream(java.io.OutputStream)
public void setVersion(java.lang.String version)
XSLOutputAttributes
setVersion
in interface XSLOutputAttributes
version
- the version of the output format.XSLOutputAttributes.setVersion(java.lang.String)
public void setWriter(java.io.Writer writer)
Serializer
The encoding specified for the output Properties
must be
identical to the output format used with the writer.
setWriter
in interface Serializer
writer
- The output writer streamSerializer.setWriter(java.io.Writer)
public void setTransformer(Transformer transformer)
SerializationHandler
setTransformer
in interface SerializationHandler
transformer
- the transformer associated with the serializer.SerializationHandler.setTransformer(javax.xml.transform.Transformer)
public Transformer getTransformer()
SerializationHandler
getTransformer
in interface SerializationHandler
SerializationHandler.getTransformer()
public void flushPending() throws SAXException
SerializationHandler
flushPending
in interface SerializationHandler
SAXException
SerializationHandler.flushPending()
public void addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value) throws SAXException
ExtendedContentHandler
addAttribute
in interface ExtendedContentHandler
uri
- the namespace URI of the attribute namelocalName
- the local name of the attribute (without prefix)rawName
- the qualified name of the attributetype
- the attribute type typically character data (CDATA)value
- the value of the attribute
SAXException
ExtendedContentHandler.addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void addAttributes(Attributes atts) throws SAXException
ExtendedContentHandler
addAttributes
in interface ExtendedContentHandler
atts
- the attributes to add.
SAXException
ExtendedContentHandler.addAttributes(org.xml.sax.Attributes)
public void addAttribute(java.lang.String name, java.lang.String value)
ExtendedContentHandler
addAttribute
in interface ExtendedContentHandler
ExtendedContentHandler.addAttribute(java.lang.String, java.lang.String)
public void characters(java.lang.String chars) throws SAXException
ExtendedContentHandler
characters
in interface ExtendedContentHandler
chars
- the character data
SAXException
ExtendedContentHandler.characters(java.lang.String)
public void endElement(java.lang.String elemName) throws SAXException
ExtendedContentHandler
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.
endElement
in interface ExtendedContentHandler
elemName
- the fully qualified element name.
SAXException
ExtendedContentHandler.endElement(java.lang.String)
public void startDocument() throws SAXException
ContentHandler
The SAX parser will invoke this method only once, before any
other event callbacks (except for setDocumentLocator
).
startDocument
in interface ContentHandler
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startDocument()
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws SAXException
ExtendedContentHandler
startElement(uri,localName,qname,atts)but without the attributes.
startElement
in interface ExtendedContentHandler
uri
- the namespace URI of the elementlocalName
- the local name (without prefix) of the elementqName
- the qualified name of the element
SAXException
ExtendedContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String)
public void startElement(java.lang.String qName) throws SAXException
ExtendedContentHandler
startElement
in interface ExtendedContentHandler
qName
- the fully qualified name of the element
SAXException
ExtendedContentHandler.startElement(java.lang.String)
public void namespaceAfterStartElement(java.lang.String uri, java.lang.String prefix) throws SAXException
ExtendedContentHandler
startPrefixMapping(prefix,uri)is used just before an element starts and applies to the element to come, not to the current element. This method applies to the current element. For example one could make the calls in this order:
startElement("prfx8:elem9") namespaceAfterStartElement("http://namespace8","prfx8")
namespaceAfterStartElement
in interface ExtendedContentHandler
uri
- the namespace URI being declaredprefix
- the prefix that maps to the given namespace
SAXException
ExtendedContentHandler.namespaceAfterStartElement(java.lang.String, java.lang.String)
public boolean startPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush) throws SAXException
ExtendedContentHandler
startPrefixMapping
in interface ExtendedContentHandler
prefix
- the prefix that maps to the given URIuri
- the namespace URI of the given prefixshouldFlush
- if true this call is like the SAX
startPrefixMapping(prefix,uri) call and the mapping applies to the
element to come. If false the mapping applies to the current element.
SAXException
ExtendedContentHandler.startPrefixMapping(java.lang.String, java.lang.String, boolean)
public void entityReference(java.lang.String entityName) throws SAXException
ExtendedContentHandler
entityReference
in interface ExtendedContentHandler
entityName
- the name of the entity
SAXException
ExtendedContentHandler.entityReference(java.lang.String)
public NamespaceMappings getNamespaceMappings()
ExtendedContentHandler
getNamespaceMappings
in interface ExtendedContentHandler
ExtendedContentHandler.getNamespaceMappings()
public java.lang.String getPrefix(java.lang.String uri)
ExtendedContentHandler
getPrefix
in interface ExtendedContentHandler
uri
- the namespace URI
ExtendedContentHandler.getPrefix(java.lang.String)
public java.lang.String getNamespaceURI(java.lang.String name, boolean isElement)
ExtendedContentHandler
getNamespaceURI
in interface ExtendedContentHandler
name
- the qualified name of an element, or attributeisElement
- true if it is an element name, false if it is an
atttribute name
ExtendedContentHandler.getNamespaceURI(java.lang.String, boolean)
public java.lang.String getNamespaceURIFromPrefix(java.lang.String prefix)
ExtendedContentHandler
getNamespaceURIFromPrefix
in interface ExtendedContentHandler
prefix
- a prefix of an element or attribute.
ExtendedContentHandler.getNamespaceURIFromPrefix(java.lang.String)
public void setDocumentLocator(Locator arg0)
ContentHandler
SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the ContentHandler interface.
The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.
Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.
setDocumentLocator
in interface ContentHandler
arg0
- An object that can return the location of
any SAX document event.ContentHandler.setDocumentLocator(org.xml.sax.Locator)
public void endDocument() throws SAXException
ContentHandler
The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.
endDocument
in interface ContentHandler
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endDocument()
public void startPrefixMapping(java.lang.String arg0, java.lang.String arg1) throws SAXException
ContentHandler
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.
startPrefixMapping
in interface ContentHandler
arg0
- The Namespace prefix being declared.
An empty string is used for the default element namespace,
which has no prefix.arg1
- The Namespace URI the prefix is mapped to.
SAXException
- The client may throw
an exception during processing.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
public void endPrefixMapping(java.lang.String arg0) throws SAXException
ContentHandler
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.
endPrefixMapping
in interface ContentHandler
arg0
- The prefix that was being mapping.
This is the empty string when a default mapping scope ends.
SAXException
- The client may throw
an exception during processing.ContentHandler.endPrefixMapping(java.lang.String)
public void startElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, Attributes arg3) throws SAXException
ContentHandler
The Parser will invoke this method at the beginning of every
element in the XML document; there will be a corresponding
endElement
event for every startElement event
(even when the element is empty). All of the element's content will be
reported, in order, before the corresponding endElement
event.
This event allows up to three name components for each element:
Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes properties:
Note that the attribute list provided will contain only
attributes with explicit values (specified or defaulted):
#IMPLIED attributes will be omitted. The attribute list
will contain attributes used for Namespace declarations
(xmlns* attributes) only if the
http://xml.org/sax/features/namespace-prefixes
property is true (it is false by default, and support for a
true value is optional).
Like characters()
, attribute values may have
characters that need more than one char
value.
startElement
in interface ContentHandler
arg0
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.arg1
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.arg2
- The qualified name (with prefix), or the
empty string if qualified names are not available.arg3
- The attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object.
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2) throws SAXException
ContentHandler
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.
endElement
in interface ContentHandler
arg0
- The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.arg1
- The local name (without prefix), or the
empty string if Namespace processing is not being
performed.arg2
- The qualified XML 1.0 name (with prefix), or the
empty string if qualified names are not available.
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void characters(char[] arg0, int arg1, int arg2) throws SAXException
ContentHandler
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).
characters
in interface ContentHandler
arg0
- The characters from the XML document.arg1
- The start position in the array.arg2
- The number of characters to read from the array.
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.characters(char[], int, int)
public void ignorableWhitespace(char[] arg0, int arg1, int arg2) throws SAXException
ContentHandler
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.
ignorableWhitespace
in interface ContentHandler
arg0
- The characters from the XML document.arg1
- The start position in the array.arg2
- The number of characters to read from the array.
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(java.lang.String arg0, java.lang.String arg1) throws SAXException
ContentHandler
The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element.
A SAX parser must never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.
Like characters()
, processing instruction
data may have characters that need more than one char
value.
processingInstruction
in interface ContentHandler
arg0
- The processing instruction target.arg1
- The processing instruction data, or null if
none was supplied. The data does not include any
whitespace separating it from the target.
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.processingInstruction(java.lang.String, java.lang.String)
public void skippedEntity(java.lang.String arg0) throws SAXException
ContentHandler
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.
skippedEntity
in interface ContentHandler
arg0
- 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]".
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.skippedEntity(java.lang.String)
public void comment(java.lang.String comment) throws SAXException
ExtendedLexicalHandler
comment
in interface ExtendedLexicalHandler
comment
- the comment, but unlike the SAX comment() method this
method takes a String rather than a character array.
SAXException
ExtendedLexicalHandler.comment(java.lang.String)
public void startDTD(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2) throws SAXException
LexicalHandler
This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.
All declarations reported through
DTDHandler
or
DeclHandler
events must appear
between the startDTD and endDTD
events.
Declarations are assumed to belong to the internal DTD subset
unless they appear between startEntity
and endEntity
events. Comments and
processing instructions from the DTD should also be reported
between the startDTD and endDTD events, in their original
order of (logical) occurrence; they are not required to
appear in their correct locations relative to DTDHandler
or DeclHandler events, however.
Note that the start/endDTD events will appear within
the start/endDocument events from ContentHandler and
before the first
startElement
event.
startDTD
in interface LexicalHandler
arg0
- The document type name.arg1
- The declared public identifier for the
external DTD subset, or null if none was declared.arg2
- The declared system identifier for the
external DTD subset, or null if none was declared.
(Note that this is not resolved against the document
base URI.)
SAXException
- The application may raise an
exception.LexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void endDTD() throws SAXException
LexicalHandler
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.
endDTD
in interface LexicalHandler
SAXException
- The application may raise an exception.LexicalHandler.endDTD()
public void startEntity(java.lang.String arg0) throws SAXException
LexicalHandler
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:
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.
startEntity
in interface LexicalHandler
arg0
- The name of the entity. If it is a parameter
entity, the name will begin with '%', and if it is the
external DTD subset, it will be "[dtd]".
SAXException
- The application may raise an exception.LexicalHandler.startEntity(java.lang.String)
public void endEntity(java.lang.String arg0) throws SAXException
LexicalHandler
endEntity
in interface LexicalHandler
arg0
- The name of the entity that is ending.
SAXException
- The application may raise an exception.LexicalHandler.endEntity(java.lang.String)
public void startCDATA() throws SAXException
LexicalHandler
The contents of the CDATA section will be reported through
the regular characters
event; this event is intended only to report
the boundary.
startCDATA
in interface LexicalHandler
SAXException
- The application may raise an exception.LexicalHandler.startCDATA()
public void endCDATA() throws SAXException
LexicalHandler
endCDATA
in interface LexicalHandler
SAXException
- The application may raise an exception.LexicalHandler.endCDATA()
public void comment(char[] arg0, int arg1, int arg2) throws SAXException
LexicalHandler
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).
comment
in interface LexicalHandler
arg0
- An array holding the characters in the comment.arg1
- The starting position in the array.arg2
- The number of characters to use from the array.
SAXException
- The application may raise an exception.LexicalHandler.comment(char[], int, int)
public java.lang.String getDoctypePublic()
XSLOutputAttributes
getDoctypePublic
in interface XSLOutputAttributes
XSLOutputAttributes.getDoctypePublic()
public java.lang.String getDoctypeSystem()
XSLOutputAttributes
getDoctypeSystem
in interface XSLOutputAttributes
XSLOutputAttributes.getDoctypeSystem()
public java.lang.String getEncoding()
getEncoding
in interface XSLOutputAttributes
XSLOutputAttributes.getEncoding()
public boolean getIndent()
getIndent
in interface XSLOutputAttributes
XSLOutputAttributes.getIndent()
public int getIndentAmount()
getIndentAmount
in interface XSLOutputAttributes
XSLOutputAttributes.getIndentAmount()
public java.lang.String getMediaType()
getMediaType
in interface XSLOutputAttributes
XSLOutputAttributes.getMediaType()
public boolean getOmitXMLDeclaration()
getOmitXMLDeclaration
in interface XSLOutputAttributes
XSLOutputAttributes.getOmitXMLDeclaration()
public java.lang.String getStandalone()
getStandalone
in interface XSLOutputAttributes
standalone
delaration is to
be included in the output document.XSLOutputAttributes.getStandalone()
public java.lang.String getVersion()
getVersion
in interface XSLOutputAttributes
XSLOutputAttributes.getVersion()
public void setCdataSectionElements(java.util.Hashtable h) throws java.lang.Exception
java.lang.Exception
XSLOutputAttributes.setCdataSectionElements(java.util.Vector)
public void setDoctype(java.lang.String system, java.lang.String pub)
XSLOutputAttributes
setDoctype
in interface XSLOutputAttributes
system
- the system identifier to be used in the DOCTYPE declaration
in the output document.pub
- the public identifier to be used in the DOCTYPE declaration in
the output document.XSLOutputAttributes.setDoctype(java.lang.String, java.lang.String)
public void setDoctypePublic(java.lang.String doctype)
XSLOutputAttributes
setDoctypePublic
in interface XSLOutputAttributes
doctype
- the public identifier to be used in the DOCTYPE
declaration in the output document.XSLOutputAttributes.setDoctypePublic(java.lang.String)
public void setDoctypeSystem(java.lang.String doctype)
XSLOutputAttributes
setDoctypeSystem
in interface XSLOutputAttributes
doctype
- the system identifier to be used in the DOCTYPE
declaration in the output document.XSLOutputAttributes.setDoctypeSystem(java.lang.String)
public void setEncoding(java.lang.String encoding)
XSLOutputAttributes
setEncoding
in interface XSLOutputAttributes
encoding
- the character encodingXSLOutputAttributes.setEncoding(java.lang.String)
public void setMediaType(java.lang.String mediatype)
XSLOutputAttributes
setMediaType
in interface XSLOutputAttributes
mediatype
- the media-type or MIME type associated with the output
document.XSLOutputAttributes.setMediaType(java.lang.String)
public void setOmitXMLDeclaration(boolean b)
XSLOutputAttributes
setOmitXMLDeclaration
in interface XSLOutputAttributes
b
- true if the XML declaration is to be omitted from the output
document.XSLOutputAttributes.setOmitXMLDeclaration(boolean)
public void setStandalone(java.lang.String standalone)
XSLOutputAttributes
setStandalone
in interface XSLOutputAttributes
standalone
- a value of "yes" indicates that the
standalone
delaration is to be included in the output
document.XSLOutputAttributes.setStandalone(java.lang.String)
public void elementDecl(java.lang.String arg0, java.lang.String arg1) throws SAXException
DeclHandler
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.
elementDecl
in interface DeclHandler
arg0
- The element type name.arg1
- The content model as a normalized string.
SAXException
- The application may raise an exception.DeclHandler.elementDecl(java.lang.String, java.lang.String)
public void attributeDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4) throws SAXException
DeclHandler
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.
attributeDecl
in interface DeclHandler
arg0
- The name of the associated element.arg1
- The name of the attribute.arg2
- A string representing the attribute type.arg3
- A string representing the attribute defaulting mode
("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
none of these applies.arg4
- A string representing the attribute's default value,
or null if there is none.
SAXException
- The application may raise an exception.DeclHandler.attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void internalEntityDecl(java.lang.String arg0, java.lang.String arg1) throws SAXException
DeclHandler
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.
internalEntityDecl
in interface DeclHandler
arg0
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.arg1
- The replacement text of the entity.
SAXException
- The application may raise an exception.DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)
public void externalEntityDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2) throws SAXException
DeclHandler
Only the effective (first) declaration for each entity will be reported.
externalEntityDecl
in interface DeclHandler
arg0
- The name of the entity. If it is a parameter
entity, the name will begin with '%'.arg1
- The declared public identifier of the entity, or
null if none was declared.arg2
- The declared system identifier of the entity.
SAXException
- The application may raise an exception.DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
public void warning(SAXParseException arg0) throws SAXException
ErrorHandler
SAX parsers will use this method to report conditions that are not errors or fatal errors as defined by the XML 1.0 recommendation. The default behaviour is to take no action.
The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end.
Filters may use this method to report other, non-XML warnings as well.
warning
in interface ErrorHandler
arg0
- The warning information encapsulated in a
SAX parse exception.
SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.warning(org.xml.sax.SAXParseException)
public void error(SAXParseException arg0) throws SAXException
ErrorHandler
This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a validating parser would use this callback to report the violation of a validity constraint. The default behaviour is to take no action.
The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the parser should report a fatal error even if the XML 1.0 recommendation does not require it to do so.
Filters may use this method to report other, non-XML errors as well.
error
in interface ErrorHandler
arg0
- The error information encapsulated in a
SAX parse exception.
SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.error(org.xml.sax.SAXParseException)
public void fatalError(SAXParseException arg0) throws SAXException
ErrorHandler
This corresponds to the definition of "fatal error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a parser would use this callback to report the violation of a well-formedness constraint.
The application must assume that the document is unusable after the parser has invoked this method, and should continue (if at all) only for the sake of collecting addition error messages: in fact, SAX parsers are free to stop reporting any other events once this method has been invoked.
fatalError
in interface ErrorHandler
arg0
- The error information encapsulated in a
SAX parse exception.
SAXException
- Any SAX exception, possibly
wrapping another exception.ErrorHandler.fatalError(org.xml.sax.SAXParseException)
public DOMSerializer asDOMSerializer() throws java.io.IOException
Serializer
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
java.io.IOException
- An I/O exception occuredSerializer.asDOMSerializer()
public void setNamespaceMappings(NamespaceMappings mappings)
SerializationHandler
setNamespaceMappings
in interface SerializationHandler
SerializationHandler.setNamespaceMappings(NamespaceMappings)
public void setSourceLocator(SourceLocator locator)
ExtendedContentHandler
setSourceLocator
in interface ExtendedContentHandler
locator
- the source locatorExtendedContentHandler.setSourceLocator(javax.xml.transform.SourceLocator)
public void addUniqueAttribute(java.lang.String name, java.lang.String value, int flags) throws SAXException
ExtendedContentHandler
addUniqueAttribute
in interface ExtendedContentHandler
name
- the fully qualified attribute name.value
- the attribute valueflags
- a bitwise flag
SAXException
ExtendedContentHandler.addUniqueAttribute(java.lang.String, java.lang.String, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |