|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.xml.serializer.SerializerBase
org.apache.xml.serializer.ToSAXHandler
Field Summary |
Fields inherited from interface org.apache.xml.serializer.ExtendedContentHandler |
HTML_ATTREMPTY, HTML_ATTRURL, NO_BAD_CHARS |
Fields inherited from interface org.apache.xml.serializer.SerializerConstants |
BEGCDATA, CDATA_CONTINUE, CDATA_DELIMITER_CLOSE, CDATA_DELIMITER_OPEN, CNTCDATA, DEFAULT_SAX_SERIALIZER, EMPTYSTRING, ENDCDATA, ENTITY_AMP, ENTITY_CRLF, ENTITY_GT, ENTITY_LT, ENTITY_QUOT, XML_PREFIX, XMLNS_PREFIX, XMLNS_URI |
Constructor Summary | |
ToSAXHandler()
|
|
ToSAXHandler(ContentHandler hdlr,
LexicalHandler lex,
java.lang.String encoding)
|
|
ToSAXHandler(ContentHandler handler,
java.lang.String encoding)
|
Method Summary | |
void |
addUniqueAttribute(java.lang.String qName,
java.lang.String value,
int flags)
Add a unique attribute |
void |
characters(Node node)
This method gets the node's value as a String and uses that String as if it were an input character notification. |
void |
characters(java.lang.String characters)
Receive notification of character data. |
void |
comment(java.lang.String comment)
Receive notification of a comment. |
void |
error(SAXParseException exc)
Receive notification of a recoverable error. |
void |
fatalError(SAXParseException exc)
Receive notification of a non-recoverable error. |
void |
flushPending()
This method flushes any pending events, which can be startDocument() closing the opening tag of an element, or closing an open CDATA section. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Do nothing as this is an abstract class. |
boolean |
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). |
void |
setCdataSectionElements(java.util.Vector URI_and_localNames)
Does nothing. |
void |
setContentHandler(ContentHandler _saxHandler)
Sets the SAX ContentHandler. |
void |
setLexHandler(LexicalHandler _lexHandler)
Sets the LexicalHandler. |
void |
setShouldOutputNSAttr(boolean doOutputNSAttr)
Set whether or not namespace declarations (e.g. |
void |
setTransformState(TransformStateSetter ts)
Pass in a reference to a TransformState object, which can be used during SAX ContentHandler events to obtain information about he state of the transformation. |
void |
startDTD(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
Do nothing. |
void |
startElement(java.lang.String qName)
An element starts, but attributes are not fully known yet. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
Receives notification that an element starts, but attributes are not fully known yet. |
void |
startElement(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2,
Attributes arg3)
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. |
void |
warning(SAXParseException exc)
Receive notification of a warning. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.xml.serializer.SerializationHandler |
serialize, setEscaping |
Methods inherited from interface org.apache.xml.serializer.ExtendedContentHandler |
endElement, startPrefixMapping |
Methods inherited from interface org.xml.sax.ContentHandler |
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, skippedEntity, startPrefixMapping |
Methods inherited from interface org.xml.sax.ext.LexicalHandler |
comment, endCDATA, endDTD, startCDATA, startEntity |
Methods inherited from interface org.xml.sax.ext.DeclHandler |
attributeDecl, elementDecl, externalEntityDecl, internalEntityDecl |
Methods inherited from interface org.apache.xml.serializer.Serializer |
getOutputFormat, getOutputStream, getWriter, setOutputFormat, setOutputStream, setWriter |
Constructor Detail |
public ToSAXHandler()
public ToSAXHandler(ContentHandler hdlr, LexicalHandler lex, java.lang.String encoding)
public ToSAXHandler(ContentHandler handler, java.lang.String encoding)
Method Detail |
public void startDTD(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2) throws SAXException
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(String, String, String)
public void characters(java.lang.String characters) throws SAXException
characters
- the character data
SAXException
ExtendedContentHandler.characters(String)
public void comment(java.lang.String comment) throws SAXException
comment
in interface ExtendedLexicalHandler
comment
in class SerializerBase
SAXException
ExtendedLexicalHandler.comment(String)
public void processingInstruction(java.lang.String target, java.lang.String data) throws SAXException
target
- The processing instruction target.data
- The processing instruction data, or null if
none was supplied. The data does not include any
whitespace separating it from the target.
SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.processingInstruction(String, String)
public void startElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, Attributes arg3) throws SAXException
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.
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
,
ContentHandler.startElement(String,String,String,Attributes)
public void setLexHandler(LexicalHandler _lexHandler)
_lexHandler
- The LexicalHandler to setpublic void setContentHandler(ContentHandler _saxHandler)
Serializer.asContentHandler()
,
ToSAXHandler
public void setCdataSectionElements(java.util.Vector URI_and_localNames)
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 void setShouldOutputNSAttr(boolean doOutputNSAttr)
doOutputNSAttr
- whether or not namespace declarations
should appear as attributespublic void flushPending() throws SAXException
SAXException
public void setTransformState(TransformStateSetter ts)
ts
- A reference to a TransformState objectpublic void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws SAXException
uri
- the URI of the namespace of the element (optional)localName
- the element name, but without prefix (optional)qName
- the element name, with prefix, if any (required)
SAXException
ExtendedContentHandler.startElement(String, String, String)
public void startElement(java.lang.String qName) throws SAXException
qName
- the fully qualified name of the element
SAXException
ExtendedContentHandler.startElement(String)
public void characters(Node node) throws SAXException
characters
in interface DOM2DTM.CharacterNodeHandler
characters
in class SerializerBase
node
- the Node to serialize
SAXException
public void fatalError(SAXParseException exc) 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
fatalError
in class SerializerBase
SAXException
ErrorHandler.fatalError(SAXParseException)
public void error(SAXParseException exc) 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
error
in class SerializerBase
SAXException
ErrorHandler.error(SAXParseException)
public void warning(SAXParseException exc) 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
warning
in class SerializerBase
SAXException
ErrorHandler.warning(SAXParseException)
public boolean reset()
reset
in interface Serializer
reset
in class SerializerBase
Serializer.reset()
public void addUniqueAttribute(java.lang.String qName, java.lang.String value, int flags) throws SAXException
qName
- the fully qualified attribute name.value
- the attribute valueflags
- a bitwise flag
SAXException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |