|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xml.serializer.SerializerBase org.apache.xml.serializer.ToSAXHandler
public abstract class ToSAXHandler
This class is used to provide a base behavior to be inherited by other To...SAXHandler serializers. This class is not a public API.
Field Summary | |
---|---|
protected org.xml.sax.ext.LexicalHandler |
m_lexHandler
Underlying LexicalHandler. |
protected org.xml.sax.ContentHandler |
m_saxHandler
Underlying SAX handler. |
private boolean |
m_shouldGenerateNSAttribute
A startPrefixMapping() call on a ToSAXHandler will pass that call on to the wrapped ContentHandler, but should we also mirror these calls with matching attributes, if so this field is true. |
protected TransformStateSetter |
m_state
If this is true, then the content handler wrapped by this serializer implements the TransformState interface which will give the content handler access to the state of the transform. |
Fields inherited from class org.apache.xml.serializer.SerializerBase |
---|
m_attrBuff, m_attributes, m_CdataElems, m_cdataTagOpen, m_charsBuff, m_docIsEmpty, m_doctypePublic, m_doctypeSystem, m_doIndent, m_elemContext, m_indentAmount, m_inEntityRef, m_inExternalDTD, m_mediatype, m_needToCallStartDocument, m_needToOutputDocTypeDecl, m_prefixMap, m_shouldNotWriteXMLHeader, m_sourceLocator, m_standaloneWasSpecified, m_StringOfCDATASections, m_tracer, m_version, m_writer, PKG_NAME, PKG_PATH |
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 |
---|
CDATA_CONTINUE, CDATA_DELIMITER_CLOSE, CDATA_DELIMITER_OPEN, DEFAULT_SAX_SERIALIZER, EMPTYSTRING, ENTITY_AMP, ENTITY_CRLF, ENTITY_GT, ENTITY_LT, ENTITY_QUOT, XML_PREFIX, XMLNS_PREFIX, XMLNS_URI, XMLVERSION10, XMLVERSION11 |
Constructor Summary | |
---|---|
ToSAXHandler()
|
|
ToSAXHandler(org.xml.sax.ContentHandler hdlr,
org.xml.sax.ext.LexicalHandler lex,
java.lang.String encoding)
|
|
ToSAXHandler(org.xml.sax.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(org.w3c.dom.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. |
protected void |
closeCDATA()
|
protected void |
closeStartTag()
|
void |
comment(java.lang.String comment)
Receive notification of a comment. |
void |
error(org.xml.sax.SAXParseException exc)
|
void |
fatalError(org.xml.sax.SAXParseException exc)
|
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. |
(package private) boolean |
getShouldOutputNSAttr()
Returns true if namespace declarations from calls such as startPrefixMapping("prefix1","uri1") should also be mirrored with self generated additional attributes of elements that declare the namespace, for example the attribute xmlns:prefix1="uri1" |
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). |
private void |
resetToSAXHandler()
Reset all of the fields owned by ToSAXHandler class |
void |
setCdataSectionElements(java.util.Vector URI_and_localNames)
Does nothing. |
void |
setContentHandler(org.xml.sax.ContentHandler _saxHandler)
Sets the SAX ContentHandler. |
void |
setLexHandler(org.xml.sax.ext.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. |
protected void |
startDocumentInternal()
Pass callback to the SAX Handler |
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,
org.xml.sax.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(org.xml.sax.SAXParseException exc)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, 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 |
Field Detail |
---|
protected org.xml.sax.ContentHandler m_saxHandler
protected org.xml.sax.ext.LexicalHandler m_lexHandler
private boolean m_shouldGenerateNSAttribute
protected TransformStateSetter m_state
Constructor Detail |
---|
public ToSAXHandler()
public ToSAXHandler(org.xml.sax.ContentHandler hdlr, org.xml.sax.ext.LexicalHandler lex, java.lang.String encoding)
public ToSAXHandler(org.xml.sax.ContentHandler handler, java.lang.String encoding)
Method Detail |
---|
protected void startDocumentInternal() throws org.xml.sax.SAXException
startDocumentInternal
in class SerializerBase
org.xml.sax.SAXException
public void startDTD(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2) throws org.xml.sax.SAXException
org.xml.sax.SAXException
LexicalHandler.startDTD(String, String, String)
public void characters(java.lang.String characters) throws org.xml.sax.SAXException
characters
- The string of characters to process.
org.xml.sax.SAXException
ExtendedContentHandler.characters(String)
public void comment(java.lang.String comment) throws org.xml.sax.SAXException
comment
in interface ExtendedLexicalHandler
comment
in class SerializerBase
comment
- the comment, but unlike the SAX comment() method this
method takes a String rather than a character array.
org.xml.sax.SAXException
ExtendedLexicalHandler.comment(String)
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
org.xml.sax.SAXException
ContentHandler.processingInstruction(String, String)
protected void closeStartTag() throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void closeCDATA() throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void startElement(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, org.xml.sax.Attributes arg3) throws org.xml.sax.SAXException
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
,
ContentHandler.startElement(String,String,String,Attributes)
public void setLexHandler(org.xml.sax.ext.LexicalHandler _lexHandler)
_lexHandler
- The LexicalHandler to setpublic void setContentHandler(org.xml.sax.ContentHandler _saxHandler)
_saxHandler
- The ContentHandler to setSerializer.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 attributesboolean getShouldOutputNSAttr()
public void flushPending() throws org.xml.sax.SAXException
org.xml.sax.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 org.xml.sax.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)
org.xml.sax.SAXException
ExtendedContentHandler.startElement(String, String, String)
public void startElement(java.lang.String qName) throws org.xml.sax.SAXException
qName
- the element name, with prefix (if any).
org.xml.sax.SAXException
ExtendedContentHandler.startElement(String)
public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException
characters
in interface ExtendedContentHandler
characters
in class SerializerBase
node
- the Node to serialize
org.xml.sax.SAXException
public void fatalError(org.xml.sax.SAXParseException exc) throws org.xml.sax.SAXException
fatalError
in interface org.xml.sax.ErrorHandler
fatalError
in class SerializerBase
org.xml.sax.SAXException
ErrorHandler.fatalError(SAXParseException)
public void error(org.xml.sax.SAXParseException exc) throws org.xml.sax.SAXException
error
in interface org.xml.sax.ErrorHandler
error
in class SerializerBase
org.xml.sax.SAXException
ErrorHandler.error(SAXParseException)
public void warning(org.xml.sax.SAXParseException exc) throws org.xml.sax.SAXException
warning
in interface org.xml.sax.ErrorHandler
warning
in class SerializerBase
org.xml.sax.SAXException
ErrorHandler.warning(SAXParseException)
public boolean reset()
reset
in interface Serializer
reset
in class SerializerBase
Serializer.reset()
private void resetToSAXHandler()
public void addUniqueAttribute(java.lang.String qName, java.lang.String value, int flags) throws org.xml.sax.SAXException
qName
- the fully qualified attribute name.value
- the attribute valueflags
- a bitwise flag
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |