|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xml.serializer.SerializerBase
This class acts as a base class for the XML "serializers" and the stream serializers. It contains a number of common fields and methods.
Field Summary | |
static java.lang.String |
PKG_NAME
The name of the package that this class is in. |
static java.lang.String |
PKG_PATH
The same as the name of the package that this class is in except that '.' are replaced with '/'. |
Method Summary | |
void |
addAttribute(java.lang.String name,
java.lang.String value)
Adds the given attribute to the set of collected attributes, but only if there is a currently open element. |
void |
addAttribute(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
java.lang.String type,
java.lang.String value)
This method adds an attribute the the current element, but should not be used for an xsl:attribute child. |
void |
addAttribute(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
java.lang.String type,
java.lang.String value,
boolean XSLAttribute)
Adds the given attribute to the set of collected attributes , but only if there is a currently open element. |
boolean |
addAttributeAlways(java.lang.String uri,
java.lang.String localName,
java.lang.String rawName,
java.lang.String type,
java.lang.String value,
boolean XSLAttribute)
Adds the given attribute to the set of attributes, even if there is no currently open element. |
void |
addAttributes(Attributes atts)
Add the given attributes to the currently collected ones. |
void |
addXSLAttribute(java.lang.String name,
java.lang.String value,
java.lang.String uri)
Adds the given xsl:attribute to the set of collected attributes, but only if there is a currently open element. |
ContentHandler |
asContentHandler()
Return a ContentHandler interface into this serializer. |
java.lang.Object |
asDOM3Serializer()
Return a DOM3Serializer interface into this serializer. |
DOMSerializer |
asDOMSerializer()
Return a DOMSerializer interface into this serializer. |
void |
characters(Node node)
This method gets the nodes value as a String and uses that String as if it were an input character notification. |
void |
close()
Flush and close the underlying java.io.Writer. |
void |
comment(java.lang.String data)
Receive notification of a comment. |
boolean |
documentIsEmpty()
Return true if nothing has been sent to this result tree yet. |
void |
endEntity(java.lang.String name)
Report the end of an entity. |
void |
entityReference(java.lang.String name)
Entity reference event. |
void |
error(SAXParseException exc)
|
void |
fatalError(SAXParseException exc)
|
void |
fireEndEntity(java.lang.String name)
To fire off end entity trace event |
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()
Returns the character encoding to be used in the output document. |
boolean |
getIndent()
|
int |
getIndentAmount()
|
java.lang.String |
getMediaType()
Gets the mediatype the media-type or MIME type associated with the output document. |
NamespaceMappings |
getNamespaceMappings()
Some users of the serializer may need the current namespace mappings |
java.lang.String |
getNamespaceURI(java.lang.String qname,
boolean isElement)
Returns the URI of an element or attribute. |
java.lang.String |
getNamespaceURIFromPrefix(java.lang.String prefix)
Returns the URI of prefix (if any) |
boolean |
getOmitXMLDeclaration()
|
java.lang.String |
getOutputProperty(java.lang.String name)
Get the value of an output property, the explicit value, if any, otherwise the default value, if any, otherwise null. |
java.lang.String |
getOutputPropertyDefault(java.lang.String name)
Get the default value of an xsl:output property, which would be null only if no default value exists for the property. |
java.lang.String |
getOutputPropertyNonDefault(java.lang.String name)
Get the value of an output property, not the default value. |
java.lang.String |
getPrefix(java.lang.String namespaceURI)
Returns the prefix currently pointing to the given URI (if any). |
java.lang.String |
getStandalone()
Gets the XSL standalone attribute |
Transformer |
getTransformer()
Gets the transformer associated with this serializer |
java.lang.String |
getVersion()
Gets the version of the output format. |
void |
namespaceAfterStartElement(java.lang.String uri,
java.lang.String prefix)
This method is used when a prefix/uri namespace mapping is indicated after the element was started with a startElement() and before and endElement(). |
void |
notationDecl(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2)
|
boolean |
reset()
|
void |
setDoctype(java.lang.String doctypeSystem,
java.lang.String doctypePublic)
Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties |
void |
setDoctypePublic(java.lang.String doctypePublic)
Set the value coming from the xsl:output doctype-public stylesheet attribute. |
void |
setDoctypeSystem(java.lang.String doctypeSystem)
Set the value coming from the xsl:output doctype-system stylesheet attribute. |
void |
setDocumentLocator(Locator locator)
Receive an object for locating the origin of SAX document events. |
void |
setDTDEntityExpansion(boolean expand)
If set to false the serializer does not expand DTD entities, but leaves them as is, the default value is true. |
void |
setEncoding(java.lang.String encoding)
Sets the character encoding coming from the xsl:output encoding stylesheet attribute. |
void |
setIndent(boolean doIndent)
Sets the value coming from the xsl:output indent stylesheet attribute. |
void |
setIndentAmount(int m_indentAmount)
Sets the indentation amount. |
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 |
setOutputProperty(java.lang.String name,
java.lang.String val)
Set the value for the output property, typically from an xsl:output element, but this does not change what the default value is. |
void |
setOutputPropertyDefault(java.lang.String name,
java.lang.String val)
Set the default value for an output property, but this does not impact any explicitly set value. |
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 t)
Sets the transformer associated with this serializer |
void |
setVersion(java.lang.String version)
Sets the value coming from the xsl:output version attribute. |
void |
startDocument()
Receive notification of the beginning of a document. |
void |
unparsedEntityDecl(java.lang.String arg0,
java.lang.String arg1,
java.lang.String arg2,
java.lang.String arg3)
|
void |
warning(SAXParseException exc)
|
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String PKG_NAME
Not a public API.
public static final java.lang.String PKG_PATH
Not a public API.
Method Detail |
public void comment(java.lang.String data) throws SAXException
ExtendedLexicalHandler.comment(String)
public void setDocumentLocator(Locator locator)
locator
- An object that can return the location of any SAX document
event.
Receive an object for locating the origin of SAX document events.
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 DocumentHandler 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.
public void addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value, boolean XSLAttribute) throws SAXException
uri
- the URI of the attributelocalName
- the local name of the attributerawName
- the qualified name of the attributetype
- the type of the attribute (probably CDATA)value
- the value of the attributeXSLAttribute
- true if this attribute is coming from an xsl:attriute elementExtendedContentHandler.addAttribute(String, String, String, String, String)
public boolean addAttributeAlways(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value, boolean XSLAttribute)
uri
- the URI of the attributelocalName
- the local name of the attributerawName
- the qualified name of the attributetype
- the type of the attribute (probably CDATA)value
- the value of the attributeXSLAttribute
- true if this attribute is coming from an xsl:attribute elementpublic void addAttribute(java.lang.String name, java.lang.String value)
name
- the attribute's qualified namevalue
- the value of the attributepublic void addXSLAttribute(java.lang.String name, java.lang.String value, java.lang.String uri)
name
- the attribute's qualified name (prefix:localName)value
- the value of the attributeuri
- the URI that the prefix of the name points topublic void addAttributes(Attributes atts) throws SAXException
atts
- List of attributes to add to this listpublic ContentHandler asContentHandler() throws java.io.IOException
ContentHandler
interface into this serializer.
If the serializer does not support the ContentHandler
interface, it should return null.ContentHandler
interface into this serializer,
or null if the serializer is not SAX 2 capablepublic void endEntity(java.lang.String name) throws SAXException
name
- The name of the entity that is ending.LexicalHandler.startEntity(java.lang.String)
public void close()
ToStream
public java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
m_encoding
- the character encodingpublic void setOmitXMLDeclaration(boolean b)
b
- true if the XML declaration is to be omitted from the output
document.public boolean getOmitXMLDeclaration()
public java.lang.String getDoctypePublic()
public void setDoctypePublic(java.lang.String doctypePublic)
doctypePublic
- the public identifier to be used in the DOCTYPE
declaration in the output document.public java.lang.String getDoctypeSystem()
public void setDoctypeSystem(java.lang.String doctypeSystem)
doctypeSystem
- the system identifier to be used in the DOCTYPE
declaration in the output document.public void setDoctype(java.lang.String doctypeSystem, java.lang.String doctypePublic)
doctypeSystem
- the system identifier to be used in the DOCTYPE
declaration in the output document.doctypePublic
- the public identifier to be used in the DOCTYPE
declaration in the output document.public void setStandalone(java.lang.String standalone)
standalone
- a value of "yes" indicates that the
standalone
delaration is to be included in the output
document. This method remembers if the value was explicitly set using
this method, verses if the value is the default value.public java.lang.String getStandalone()
standalone
delaration is to
be included in the output document.XSLOutputAttributes.getStandalone()
public boolean getIndent()
public java.lang.String getMediaType()
public java.lang.String getVersion()
public void setVersion(java.lang.String version)
version
- the version of the output format.XSLOutputAttributes.setVersion(String)
public void setMediaType(java.lang.String mediaType)
mediaType
- the non-null media-type or MIME type associated with the
output document.OutputKeys.MEDIA_TYPE
,
XSLOutputAttributes.setMediaType(String)
public int getIndentAmount()
public void setIndentAmount(int m_indentAmount)
m_indentAmount
- The m_indentAmount to setpublic void setIndent(boolean doIndent)
doIndent
- true if the output document should be indented to
visually indicate its structure.XSLOutputAttributes.setIndent(boolean)
public void namespaceAfterStartElement(java.lang.String uri, java.lang.String prefix) throws SAXException
uri
- the URI of the namespaceprefix
- the prefix associated with the given URI.ExtendedContentHandler.namespaceAfterStartElement(String, String)
public DOMSerializer asDOMSerializer() throws java.io.IOException
DOMSerializer
interface into this serializer. If the
serializer does not support the DOMSerializer
interface, it should
return null.DOMSerializer
interface into this serializer, or null
if the serializer is not DOM capableSerializer.asDOMSerializer()
public NamespaceMappings getNamespaceMappings()
ExtendedContentHandler.getNamespaceMappings()
public java.lang.String getPrefix(java.lang.String namespaceURI)
namespaceURI
- the uri of the namespace in questionExtendedContentHandler.getPrefix(String)
public java.lang.String getNamespaceURI(java.lang.String qname, boolean isElement)
qname
- a qualified nameisElement
- true if the qualified name is the name of
an element.public java.lang.String getNamespaceURIFromPrefix(java.lang.String prefix)
prefix
- the prefix whose URI is searched forpublic void entityReference(java.lang.String name) throws SAXException
name
- Name of entitypublic void setTransformer(Transformer t)
t
- the transformer associated with this serializer.SerializationHandler.setTransformer(Transformer)
public Transformer getTransformer()
SerializationHandler.getTransformer()
public void characters(Node node) throws SAXException
node
- the Node to serializepublic void error(SAXParseException exc) throws SAXException
ErrorHandler.error(SAXParseException)
public void fatalError(SAXParseException exc) throws SAXException
ErrorHandler.fatalError(SAXParseException)
public void warning(SAXParseException exc) throws SAXException
ErrorHandler.warning(SAXParseException)
public void fireEndEntity(java.lang.String name) throws SAXException
name
- Name of entitypublic void startDocument() throws SAXException
The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).
public void setSourceLocator(SourceLocator locator)
locator
- the source locatorExtendedContentHandler.setSourceLocator(javax.xml.transform.SourceLocator)
public void setNamespaceMappings(NamespaceMappings mappings)
mappings
- NamespaceMappingspublic boolean reset()
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(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void notationDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2) throws SAXException
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
public void unparsedEntityDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3) throws SAXException
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void setDTDEntityExpansion(boolean expand)
public boolean documentIsEmpty()
This is not a public API.
public java.lang.String getOutputProperty(java.lang.String name)
public java.lang.String getOutputPropertyNonDefault(java.lang.String name)
public java.lang.Object asDOM3Serializer() throws java.io.IOException
DOM3Serializer
interface into this serializer. If the
serializer does not support the DOM3Serializer
interface, it should
return null.DOM3Serializer
interface into this serializer, or null
if the serializer is not DOM capableSerializer.asDOM3Serializer()
public java.lang.String getOutputPropertyDefault(java.lang.String name)
public void setOutputProperty(java.lang.String name, java.lang.String val)
public void setOutputPropertyDefault(java.lang.String name, java.lang.String val)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |