Class ToUnknownStream
- java.lang.Object
-
- org.apache.xml.serializer.SerializerBase
-
- org.apache.xml.serializer.ToUnknownStream
-
- All Implemented Interfaces:
DOMSerializer
,ExtendedContentHandler
,ExtendedLexicalHandler
,SerializationHandler
,Serializer
,org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.ErrorHandler
,org.xml.sax.ext.DeclHandler
,org.xml.sax.ext.LexicalHandler
public final class ToUnknownStream extends SerializerBase
This class wraps another SerializationHandler. The wrapped object will either handler XML or HTML, which is not known until a little later when the first XML tag is seen. If the first tag is then the wrapped object is an HTML handler, otherwise it is an XML handler. This class effectively caches the first few calls to it then passes them on to the wrapped handler (once it exists). After that subsequent calls a simply passed directly to the wrapped handler. The user of this class doesn't know if the output is ultimatley XML or HTML. This class is not a public API, it is public because it is used within Xalan.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CDATA_CONTINUE
To insert ]]> in a CDATA section by ending the last CDATA section with ]] and starting the next CDATA section with >static java.lang.String
CDATA_DELIMITER_CLOSE
The constant "]]>"static java.lang.String
CDATA_DELIMITER_OPEN
static java.lang.String
DEFAULT_SAX_SERIALIZER
static java.lang.String
ENTITY_AMP
static java.lang.String
ENTITY_CRLF
static java.lang.String
ENTITY_GT
static java.lang.String
ENTITY_LT
static java.lang.String
ENTITY_QUOT
static java.lang.String
XML_PREFIX
static java.lang.String
XMLNS_PREFIX
static java.lang.String
XMLNS_URI
static java.lang.String
XMLVERSION10
static java.lang.String
XMLVERSION11
Define the XML version.-
Fields inherited from class org.apache.xml.serializer.SerializerBase
PKG_NAME, PKG_PATH
-
Fields inherited from interface org.apache.xml.serializer.ExtendedContentHandler
HTML_ATTREMPTY, HTML_ATTRURL, NO_BAD_CHARS
-
-
Constructor Summary
Constructors Constructor Description ToUnknownStream()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(java.lang.String rawName, java.lang.String value)
Adds an attribute to the currenly open tagvoid
addAttribute(java.lang.String uri, java.lang.String localName, java.lang.String rawName, java.lang.String type, java.lang.String value, boolean XSLAttribute)
Adds an attribute to the currenly open tagvoid
addAttributes(org.xml.sax.Attributes atts)
Add the given attributes to the currently collected ones.void
addUniqueAttribute(java.lang.String rawName, java.lang.String value, int flags)
Adds a unique attribute to the currenly open tagorg.xml.sax.ContentHandler
asContentHandler()
Return aContentHandler
interface into this serializer.java.lang.Object
asDOM3Serializer()
Return aDOM3Serializer
interface into this serializer.DOMSerializer
asDOMSerializer()
Return aDOMSerializer
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)
Pass the call on to the underlying handlervoid
characters(char[] characters, int offset, int length)
Pass the call on to the underlying handlervoid
characters(java.lang.String chars)
Converts the String to a character array and calls the SAX method characters(char[],int,int);void
close()
Flush and close the underlying java.io.Writer.void
comment(char[] ch, int start, int length)
Pass the call on to the underlying handlervoid
comment(java.lang.String comment)
Pass the call on to the underlying handlervoid
elementDecl(java.lang.String arg0, java.lang.String arg1)
Pass the call on to the underlying handlervoid
endCDATA()
Pass the call on to the underlying handlervoid
endDocument()
Pass the call on to the underlying handlervoid
endDTD()
Pass the call on to the underlying handlervoid
endElement(java.lang.String elementName)
Pass the call on to the underlying handlervoid
endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
Pass the call on to the underlying handlervoid
endEntity(java.lang.String name)
Pass the call on to the underlying handlervoid
endPrefixMapping(java.lang.String prefix)
Pass the call on to the underlying handlervoid
entityReference(java.lang.String entityName)
Entity reference event.void
externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
Pass the call on to the underlying handlervoid
flushPending()
A SerializationHandler accepts SAX-like events, so it can accumulate attributes or namespace nodes after a startElement().java.lang.String
getDoctypePublic()
Pass the call on to the underlying handlerjava.lang.String
getDoctypeSystem()
Pass the call on to the underlying handlerjava.lang.String
getEncoding()
Pass the call on to the underlying handlerboolean
getIndent()
Pass the call on to the underlying handlerint
getIndentAmount()
Pass the call on to the underlying handlerjava.lang.String
getMediaType()
Pass the call on to the underlying handlerNamespaceMappings
getNamespaceMappings()
Get 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()
Pass the call on to the underlying handlerjava.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 namespaceURI)
Returns the prefix currently pointing to the given URI (if any).java.lang.String
getStandalone()
Pass the call on to the underlying handlerjavax.xml.transform.Transformer
getTransformer()
Gets the transformer associated with this serializerjava.lang.String
getVersion()
Pass the call on to the underlying handlerjava.io.Writer
getWriter()
Get the character stream where the events will be serialized to.void
ignorableWhitespace(char[] ch, int start, int length)
Pass the call on to the underlying handlervoid
internalEntityDecl(java.lang.String arg0, java.lang.String arg1)
Pass the call on to the underlying handlervoid
namespaceAfterStartElement(java.lang.String prefix, java.lang.String uri)
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
processingInstruction(java.lang.String target, java.lang.String data)
Pass the call on to the underlying handlerboolean
reset()
passes the call on to the underlying HTML or XML handlervoid
serialize(org.w3c.dom.Node node)
Converts the DOM node to outputvoid
setCdataSectionElements(java.util.Vector URI_and_localNames)
void
setContentHandler(org.xml.sax.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 propertiesvoid
setDoctypePublic(java.lang.String doctype)
Set the doctype in the underlying XML handler.void
setDoctypeSystem(java.lang.String doctype)
Set the doctype in the underlying XML handler.void
setDocumentLocator(org.xml.sax.Locator locator)
Pass the call on to the underlying handlervoid
setEncoding(java.lang.String encoding)
Pass the call on to the underlying handlerboolean
setEscaping(boolean escape)
Turns special character escaping on/off.void
setIndent(boolean indent)
Pass the call on to the underlying handlervoid
setIndentAmount(int value)
Pass the call on to the underlying handlervoid
setMediaType(java.lang.String mediaType)
Sets the value coming from the xsl:output media-type stylesheet attribute.void
setOmitXMLDeclaration(boolean b)
Pass the call on to the underlying handlervoid
setOutputFormat(java.util.Properties format)
Set the properties of the handlervoid
setOutputStream(java.io.OutputStream output)
Sets the output stream to write tovoid
setSourceLocator(javax.xml.transform.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)
Pass the call on to the underlying handlervoid
setTransformer(javax.xml.transform.Transformer t)
Sets the transformer associated with this serializervoid
setVersion(java.lang.String version)
This method cannot be cached because default is different in HTML and XML (we need more than a boolean).void
setWriter(java.io.Writer writer)
Sets the writer to write tovoid
skippedEntity(java.lang.String name)
Pass the call on to the underlying handlervoid
startCDATA()
Pass the call on to the underlying handlervoid
startDocument()
Receive notification of the beginning of a document.void
startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
Pass the call on to the underlying handlervoid
startElement(java.lang.String qName)
This method is used to notify of the start of an elementvoid
startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
This method is used to notify that an element is starting.void
startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String elementName, org.xml.sax.Attributes atts)
void
startEntity(java.lang.String name)
Pass the call on to the underlying handlervoid
startPrefixMapping(java.lang.String prefix, java.lang.String uri)
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.-
Methods inherited from class org.apache.xml.serializer.SerializerBase
addAttribute, addAttributeAlways, addXSLAttribute, characters, documentIsEmpty, error, fatalError, fireEndEntity, getOutputProperty, getOutputPropertyDefault, getOutputPropertyNonDefault, notationDecl, setDTDEntityExpansion, setNamespaceMappings, setOutputProperty, setOutputPropertyDefault, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
CDATA_CONTINUE
public static final java.lang.String CDATA_CONTINUE
To insert ]]> in a CDATA section by ending the last CDATA section with ]] and starting the next CDATA section with >- See Also:
- Constant Field Values
-
CDATA_DELIMITER_CLOSE
public static final java.lang.String CDATA_DELIMITER_CLOSE
The constant "]]>"- See Also:
- Constant Field Values
-
CDATA_DELIMITER_OPEN
public static final java.lang.String CDATA_DELIMITER_OPEN
- See Also:
- Constant Field Values
-
ENTITY_AMP
public static final java.lang.String ENTITY_AMP
- See Also:
- Constant Field Values
-
ENTITY_CRLF
public static final java.lang.String ENTITY_CRLF
- See Also:
- Constant Field Values
-
ENTITY_GT
public static final java.lang.String ENTITY_GT
- See Also:
- Constant Field Values
-
ENTITY_LT
public static final java.lang.String ENTITY_LT
- See Also:
- Constant Field Values
-
ENTITY_QUOT
public static final java.lang.String ENTITY_QUOT
- See Also:
- Constant Field Values
-
XML_PREFIX
public static final java.lang.String XML_PREFIX
- See Also:
- Constant Field Values
-
XMLNS_PREFIX
public static final java.lang.String XMLNS_PREFIX
- See Also:
- Constant Field Values
-
XMLNS_URI
public static final java.lang.String XMLNS_URI
- See Also:
- Constant Field Values
-
DEFAULT_SAX_SERIALIZER
public static final java.lang.String DEFAULT_SAX_SERIALIZER
-
XMLVERSION11
public static final java.lang.String XMLVERSION11
Define the XML version.- See Also:
- Constant Field Values
-
XMLVERSION10
public static final java.lang.String XMLVERSION10
- See Also:
- Constant Field Values
-
-
Method Detail
-
asContentHandler
public org.xml.sax.ContentHandler asContentHandler() throws java.io.IOException
Description copied from class:SerializerBase
Return aContentHandler
interface into this serializer. If the serializer does not support theContentHandler
interface, it should return null.- Specified by:
asContentHandler
in interfaceSerializer
- Overrides:
asContentHandler
in classSerializerBase
- Returns:
- the wrapped XML or HTML handler
- Throws:
java.io.IOException
- An I/O exception occured- See Also:
Serializer.asContentHandler()
-
close
public void close()
Description copied from class:SerializerBase
Flush and close the underlying java.io.Writer. This method applies to ToStream serializers, not ToSAXHandler serializers.- Specified by:
close
in interfaceSerializationHandler
- Overrides:
close
in classSerializerBase
- See Also:
SerializationHandler.close()
-
getOutputFormat
public java.util.Properties getOutputFormat()
Description copied from interface:Serializer
Returns the output format properties for this serializer.- Returns:
- the properties of the underlying handler
- See Also:
Serializer.getOutputFormat()
-
getOutputStream
public java.io.OutputStream getOutputStream()
Description copied from interface:Serializer
Get the output stream where the events will be serialized to.- Returns:
- the OutputStream of the underlying XML or HTML handler
- See Also:
Serializer.getOutputStream()
-
getWriter
public java.io.Writer getWriter()
Description copied from interface:Serializer
Get the character stream where the events will be serialized to.- Returns:
- the Writer of the underlying XML or HTML handler
- See Also:
Serializer.getWriter()
-
reset
public boolean reset()
passes the call on to the underlying HTML or XML handler- Specified by:
reset
in interfaceSerializer
- Overrides:
reset
in classSerializerBase
- Returns:
- ???
- See Also:
Serializer.reset()
-
serialize
public void serialize(org.w3c.dom.Node node) throws java.io.IOException
Converts the DOM node to output- Parameters:
node
- the DOM node to transform to output- Throws:
java.io.IOException
- if an I/O exception occured while serializing- See Also:
DOMSerializer.serialize(Node)
-
setEscaping
public boolean setEscaping(boolean escape) throws org.xml.sax.SAXException
Description copied from interface:SerializationHandler
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.- Parameters:
escape
- true if escaping is to be set on.- Throws:
org.xml.sax.SAXException
- See Also:
SerializationHandler.setEscaping(boolean)
-
setOutputFormat
public void setOutputFormat(java.util.Properties format)
Set the properties of the handler- Parameters:
format
- the output properties to set- See Also:
Serializer.setOutputFormat(Properties)
-
setOutputStream
public void setOutputStream(java.io.OutputStream output)
Sets the output stream to write to- Parameters:
output
- the OutputStream to write to- See Also:
Serializer.setOutputStream(OutputStream)
-
setWriter
public void setWriter(java.io.Writer writer)
Sets the writer to write to- Parameters:
writer
- the writer to write to- See Also:
Serializer.setWriter(Writer)
-
addAttribute
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 org.xml.sax.SAXException
Adds an attribute to the currenly open tag- Specified by:
addAttribute
in interfaceExtendedContentHandler
- Overrides:
addAttribute
in classSerializerBase
- Parameters:
uri
- the URI of a namespacelocalName
- the attribute name, without prefixrawName
- the attribute name, with prefix (if any)type
- the type of the attribute, typically "CDATA"value
- the value of the parameterXSLAttribute
- true if this attribute is coming from an xsl:attribute element- Throws:
org.xml.sax.SAXException
- See Also:
ExtendedContentHandler.addAttribute(String, String, String, String, String)
-
addAttribute
public void addAttribute(java.lang.String rawName, java.lang.String value)
Adds an attribute to the currenly open tag- Specified by:
addAttribute
in interfaceExtendedContentHandler
- Overrides:
addAttribute
in classSerializerBase
- Parameters:
rawName
- the attribute name, with prefix (if any)value
- the value of the parameter- See Also:
ExtendedContentHandler.addAttribute(String, String)
-
addUniqueAttribute
public void addUniqueAttribute(java.lang.String rawName, java.lang.String value, int flags) throws org.xml.sax.SAXException
Adds a unique attribute to the currenly open tag- Parameters:
rawName
- the fully qualified attribute name.value
- the attribute valueflags
- a bitwise flag- Throws:
org.xml.sax.SAXException
-
characters
public void characters(java.lang.String chars) throws org.xml.sax.SAXException
Converts the String to a character array and calls the SAX method characters(char[],int,int);- Parameters:
chars
- the character data- Throws:
org.xml.sax.SAXException
- See Also:
ExtendedContentHandler.characters(String)
-
endElement
public void endElement(java.lang.String elementName) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Parameters:
elementName
- the fully qualified element name.- Throws:
org.xml.sax.SAXException
- See Also:
ExtendedContentHandler.endElement(String)
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
- Parameters:
prefix
- The prefix that maps to the URIuri
- The URI for the namespace- Throws:
org.xml.sax.SAXException
- See Also:
ContentHandler.startPrefixMapping(String, String)
-
namespaceAfterStartElement
public void namespaceAfterStartElement(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException
This method is used when a prefix/uri namespace mapping is indicated after the element was started with a startElement() and before and endElement(). startPrefixMapping(prefix,uri) would be used before the startElement() call.- Specified by:
namespaceAfterStartElement
in interfaceExtendedContentHandler
- Overrides:
namespaceAfterStartElement
in classSerializerBase
- Parameters:
uri
- the URI of the namespaceprefix
- the prefix associated with the given URI.- Throws:
org.xml.sax.SAXException
- See Also:
ExtendedContentHandler.namespaceAfterStartElement(String, String)
-
startPrefixMapping
public boolean startPrefixMapping(java.lang.String prefix, java.lang.String uri, boolean shouldFlush) throws org.xml.sax.SAXException
Description copied from interface:ExtendedContentHandler
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.- Parameters:
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.- Returns:
- boolean false if the prefix mapping was already in effect (in other words we are just re-declaring), true if this is a new, never before seen mapping for the element.
- Throws:
org.xml.sax.SAXException
-
setVersion
public void setVersion(java.lang.String version)
This method cannot be cached because default is different in HTML and XML (we need more than a boolean).- Overrides:
setVersion
in classSerializerBase
- Parameters:
version
- the version of the output format.- See Also:
XSLOutputAttributes.setVersion(String)
-
startDocument
public void startDocument() throws org.xml.sax.SAXException
Description copied from class:SerializerBase
Receive notification of the beginning of a document. This method is never a self generated call, but only called externally.The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).
- Specified by:
startDocument
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startDocument
in classSerializerBase
- Throws:
org.xml.sax.SAXException
- See Also:
ContentHandler.startDocument()
-
startElement
public void startElement(java.lang.String qName) throws org.xml.sax.SAXException
Description copied from interface:ExtendedContentHandler
This method is used to notify of the start of an element- Parameters:
qName
- the fully qualified name of the element- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
Description copied from interface:ExtendedContentHandler
This method is used to notify that an element is starting. This method is just like the standard SAX methodstartElement(uri,localName,qname,atts)
but without the attributes.- Parameters:
namespaceURI
- the namespace URI of the elementlocalName
- the local name (without prefix) of the elementqName
- the qualified name of the element- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String elementName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
comment
public void comment(java.lang.String comment) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Specified by:
comment
in interfaceExtendedLexicalHandler
- Overrides:
comment
in classSerializerBase
- Parameters:
comment
- the comment, but unlike the SAX comment() method this method takes a String rather than a character array.- Throws:
org.xml.sax.SAXException
- See Also:
ExtendedLexicalHandler.comment(String)
-
getDoctypePublic
public java.lang.String getDoctypePublic()
Pass the call on to the underlying handler- Overrides:
getDoctypePublic
in classSerializerBase
- Returns:
- the public identifier to be used in the DOCTYPE declaration in the output document.
- See Also:
XSLOutputAttributes.getDoctypePublic()
-
getDoctypeSystem
public java.lang.String getDoctypeSystem()
Pass the call on to the underlying handler- Overrides:
getDoctypeSystem
in classSerializerBase
- Returns:
- the system identifier to be used in the DOCTYPE declaration in the output document.
- See Also:
XSLOutputAttributes.getDoctypeSystem()
-
getEncoding
public java.lang.String getEncoding()
Pass the call on to the underlying handler- Overrides:
getEncoding
in classSerializerBase
- Returns:
- the character encoding to be used in the output document.
- See Also:
XSLOutputAttributes.getEncoding()
-
getIndent
public boolean getIndent()
Pass the call on to the underlying handler- Overrides:
getIndent
in classSerializerBase
- Returns:
- true if the output document should be indented to visually indicate its structure.
- See Also:
XSLOutputAttributes.getIndent()
-
getIndentAmount
public int getIndentAmount()
Pass the call on to the underlying handler- Overrides:
getIndentAmount
in classSerializerBase
- Returns:
- the number of spaces to indent for each indentation level.
- See Also:
XSLOutputAttributes.getIndentAmount()
-
getMediaType
public java.lang.String getMediaType()
Pass the call on to the underlying handler- Overrides:
getMediaType
in classSerializerBase
- Returns:
- the mediatype the media-type or MIME type associated with the output document.
- See Also:
XSLOutputAttributes.getMediaType()
-
getOmitXMLDeclaration
public boolean getOmitXMLDeclaration()
Pass the call on to the underlying handler- Overrides:
getOmitXMLDeclaration
in classSerializerBase
- Returns:
- true if the XML declaration is to be omitted from the output document.
- See Also:
XSLOutputAttributes.getOmitXMLDeclaration()
-
getStandalone
public java.lang.String getStandalone()
Pass the call on to the underlying handler- Overrides:
getStandalone
in classSerializerBase
- Returns:
- a value of "yes" if the
standalone
delaration is to be included in the output document. - See Also:
XSLOutputAttributes.getStandalone()
-
getVersion
public java.lang.String getVersion()
Pass the call on to the underlying handler- Overrides:
getVersion
in classSerializerBase
- Returns:
- the version of the output format.
- See Also:
XSLOutputAttributes.getVersion()
-
setDoctype
public void setDoctype(java.lang.String system, java.lang.String pub)
Description copied from class:SerializerBase
Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties- Overrides:
setDoctype
in classSerializerBase
- Parameters:
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.- See Also:
XSLOutputAttributes.setDoctype(String, String)
-
setDoctypePublic
public void setDoctypePublic(java.lang.String doctype)
Set the doctype in the underlying XML handler. Remember that this method was called, just in case we need to transfer this doctype to an HTML handler- Overrides:
setDoctypePublic
in classSerializerBase
- Parameters:
doctype
- the public doctype to set- See Also:
XSLOutputAttributes.setDoctypePublic(String)
-
setDoctypeSystem
public void setDoctypeSystem(java.lang.String doctype)
Set the doctype in the underlying XML handler. Remember that this method was called, just in case we need to transfer this doctype to an HTML handler- Overrides:
setDoctypeSystem
in classSerializerBase
- Parameters:
doctype
- the system doctype to set- See Also:
XSLOutputAttributes.setDoctypeSystem(String)
-
setEncoding
public void setEncoding(java.lang.String encoding)
Pass the call on to the underlying handler- Overrides:
setEncoding
in classSerializerBase
- See Also:
XSLOutputAttributes.setEncoding(String)
-
setIndent
public void setIndent(boolean indent)
Pass the call on to the underlying handler- Overrides:
setIndent
in classSerializerBase
- Parameters:
indent
- true if the output document should be indented to visually indicate its structure.- See Also:
XSLOutputAttributes.setIndent(boolean)
-
setIndentAmount
public void setIndentAmount(int value)
Pass the call on to the underlying handler- Specified by:
setIndentAmount
in interfaceSerializationHandler
- Overrides:
setIndentAmount
in classSerializerBase
- Parameters:
value
- The m_indentAmount to set
-
setMediaType
public void setMediaType(java.lang.String mediaType)
Description copied from class:SerializerBase
Sets the value coming from the xsl:output media-type stylesheet attribute.- Overrides:
setMediaType
in classSerializerBase
- Parameters:
mediaType
- the non-null media-type or MIME type associated with the output document.- See Also:
XSLOutputAttributes.setMediaType(String)
-
setOmitXMLDeclaration
public void setOmitXMLDeclaration(boolean b)
Pass the call on to the underlying handler- Overrides:
setOmitXMLDeclaration
in classSerializerBase
- Parameters:
b
- true if the XML declaration is to be omitted from the output document.- See Also:
XSLOutputAttributes.setOmitXMLDeclaration(boolean)
-
setStandalone
public void setStandalone(java.lang.String standalone)
Pass the call on to the underlying handler- Overrides:
setStandalone
in classSerializerBase
- Parameters:
standalone
- a value of "yes" indicates that thestandalone
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.- See Also:
XSLOutputAttributes.setStandalone(String)
-
attributeDecl
public void attributeDecl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
DeclHandler.attributeDecl(String, String, String, String, String)
-
elementDecl
public void elementDecl(java.lang.String arg0, java.lang.String arg1) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
DeclHandler.elementDecl(String, String)
-
externalEntityDecl
public void externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
DeclHandler.externalEntityDecl(String, String, String)
-
internalEntityDecl
public void internalEntityDecl(java.lang.String arg0, java.lang.String arg1) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
DeclHandler.internalEntityDecl(String, String)
-
characters
public void characters(char[] characters, int offset, int length) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
ContentHandler.characters(char[], int, int)
-
endDocument
public void endDocument() throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
ContentHandler.endDocument()
-
endElement
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
ContentHandler.endElement(String, String, String)
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
ContentHandler.endPrefixMapping(String)
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
ContentHandler.ignorableWhitespace(char[], int, int)
-
processingInstruction
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
ContentHandler.processingInstruction(String, String)
-
setDocumentLocator
public void setDocumentLocator(org.xml.sax.Locator locator)
Pass the call on to the underlying handler- Specified by:
setDocumentLocator
in interfaceorg.xml.sax.ContentHandler
- Overrides:
setDocumentLocator
in classSerializerBase
- Parameters:
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.
- See Also:
ContentHandler.setDocumentLocator(Locator)
-
skippedEntity
public void skippedEntity(java.lang.String name) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
ContentHandler.skippedEntity(String)
-
comment
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
LexicalHandler.comment(char[], int, int)
-
endCDATA
public void endCDATA() throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
LexicalHandler.endCDATA()
-
endDTD
public void endDTD() throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
LexicalHandler.endDTD()
-
endEntity
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Specified by:
endEntity
in interfaceorg.xml.sax.ext.LexicalHandler
- Overrides:
endEntity
in classSerializerBase
- Parameters:
name
- The name of the entity that is ending.- Throws:
org.xml.sax.SAXException
- The application may raise an exception.- See Also:
LexicalHandler.endEntity(String)
-
startCDATA
public void startCDATA() throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
LexicalHandler.startCDATA()
-
startDTD
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
LexicalHandler.startDTD(String, String, String)
-
startEntity
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
Pass the call on to the underlying handler- Throws:
org.xml.sax.SAXException
- See Also:
LexicalHandler.startEntity(String)
-
asDOMSerializer
public DOMSerializer asDOMSerializer() throws java.io.IOException
Description copied from class:SerializerBase
Return aDOMSerializer
interface into this serializer. If the serializer does not support theDOMSerializer
interface, it should return null.- Specified by:
asDOMSerializer
in interfaceSerializer
- Overrides:
asDOMSerializer
in classSerializerBase
- Returns:
- A
DOMSerializer
interface into this serializer, or null if the serializer is not DOM capable - Throws:
java.io.IOException
- An I/O exception occured- See Also:
Serializer.asDOMSerializer()
-
setCdataSectionElements
public void setCdataSectionElements(java.util.Vector URI_and_localNames)
- Parameters:
URI_and_localNames
- Vector a list of pairs of URI/localName specified in the cdata-section-elements attribute.- See Also:
XSLOutputAttributes.setCdataSectionElements(java.util.Vector)
-
addAttributes
public void addAttributes(org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
Description copied from class:SerializerBase
Add the given attributes to the currently collected ones. These attributes are always added, regardless of whether on not an element is currently open.- Specified by:
addAttributes
in interfaceExtendedContentHandler
- Overrides:
addAttributes
in classSerializerBase
- Parameters:
atts
- List of attributes to add to this list- Throws:
org.xml.sax.SAXException
- See Also:
ExtendedContentHandler.addAttributes(org.xml.sax.Attributes)
-
getNamespaceMappings
public NamespaceMappings getNamespaceMappings()
Get the current namespace mappings. Simply returns the mappings of the wrapped handler.- Specified by:
getNamespaceMappings
in interfaceExtendedContentHandler
- Overrides:
getNamespaceMappings
in classSerializerBase
- Returns:
- the current namespace mappings (prefix/uri)
- See Also:
ExtendedContentHandler.getNamespaceMappings()
-
flushPending
public void flushPending() throws org.xml.sax.SAXException
Description copied from interface:SerializationHandler
A SerializationHandler accepts SAX-like events, so it can accumulate attributes or namespace nodes after a startElement().If the SerializationHandler has a Writer or OutputStream, a call to this method will flush such accumulated events as a closed start tag for an element.
If the SerializationHandler wraps a ContentHandler, a call to this method will flush such accumulated events as a SAX (not SAX-like) calls to startPrefixMapping() and startElement().
If one calls endDocument() then one need not call this method since a call to endDocument() will do what this method does. However, in some circumstances, such as with document fragments, endDocument() is not called and it may be necessary to call this method to flush any pending events.
For performance reasons this method should not be called very often.
- Throws:
org.xml.sax.SAXException
- See Also:
SerializationHandler.flushPending()
-
getPrefix
public java.lang.String getPrefix(java.lang.String namespaceURI)
Description copied from class:SerializerBase
Returns the prefix currently pointing to the given URI (if any).- Specified by:
getPrefix
in interfaceExtendedContentHandler
- Overrides:
getPrefix
in classSerializerBase
- Parameters:
namespaceURI
- the uri of the namespace in question- Returns:
- a prefix pointing to the given URI (if any).
- See Also:
ExtendedContentHandler.getPrefix(java.lang.String)
-
entityReference
public void entityReference(java.lang.String entityName) throws org.xml.sax.SAXException
Description copied from class:SerializerBase
Entity reference event.- Specified by:
entityReference
in interfaceExtendedContentHandler
- Overrides:
entityReference
in classSerializerBase
- Parameters:
entityName
- Name of entity- Throws:
org.xml.sax.SAXException
- See Also:
ExtendedContentHandler.entityReference(java.lang.String)
-
getNamespaceURI
public java.lang.String getNamespaceURI(java.lang.String qname, boolean isElement)
Description copied from class:SerializerBase
Returns the URI of an element or attribute. Note that default namespaces do not apply directly to attributes.- Specified by:
getNamespaceURI
in interfaceExtendedContentHandler
- Overrides:
getNamespaceURI
in classSerializerBase
- Parameters:
qname
- a qualified nameisElement
- true if the qualified name is the name of an element.- Returns:
- returns the namespace URI associated with the qualified name.
- See Also:
ExtendedContentHandler.getNamespaceURI(java.lang.String, boolean)
-
getNamespaceURIFromPrefix
public java.lang.String getNamespaceURIFromPrefix(java.lang.String prefix)
Description copied from class:SerializerBase
Returns the URI of prefix (if any)- Specified by:
getNamespaceURIFromPrefix
in interfaceExtendedContentHandler
- Overrides:
getNamespaceURIFromPrefix
in classSerializerBase
- Parameters:
prefix
- the prefix whose URI is searched for- Returns:
- the namespace URI currently associated with the prefix, null if the prefix is undefined.
-
setTransformer
public void setTransformer(javax.xml.transform.Transformer t)
Description copied from class:SerializerBase
Sets the transformer associated with this serializer- Specified by:
setTransformer
in interfaceSerializationHandler
- Overrides:
setTransformer
in classSerializerBase
- Parameters:
t
- the transformer associated with this serializer.- See Also:
SerializationHandler.setTransformer(Transformer)
-
getTransformer
public javax.xml.transform.Transformer getTransformer()
Description copied from class:SerializerBase
Gets the transformer associated with this serializer- Specified by:
getTransformer
in interfaceSerializationHandler
- Overrides:
getTransformer
in classSerializerBase
- Returns:
- returns the transformer associated with this serializer.
- See Also:
SerializationHandler.getTransformer()
-
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler ch)
Description copied from interface:SerializationHandler
Set the SAX Content handler that the serializer sends its output to. This method only applies to a ToSAXHandler, not to a ToStream serializer.
-
setSourceLocator
public void setSourceLocator(javax.xml.transform.SourceLocator locator)
This method is used to set the source locator, which might be used to generated an error message.- Specified by:
setSourceLocator
in interfaceExtendedContentHandler
- Overrides:
setSourceLocator
in classSerializerBase
- Parameters:
locator
- the source locator- See Also:
ExtendedContentHandler.setSourceLocator(javax.xml.transform.SourceLocator)
-
asDOM3Serializer
public java.lang.Object asDOM3Serializer() throws java.io.IOException
Description copied from class:SerializerBase
Return aDOM3Serializer
interface into this serializer. If the serializer does not support theDOM3Serializer
interface, it should return null.- Specified by:
asDOM3Serializer
in interfaceSerializer
- Overrides:
asDOM3Serializer
in classSerializerBase
- Returns:
- A
DOM3Serializer
interface into this serializer, or null if the serializer is not DOM capable - Throws:
java.io.IOException
- An I/O exception occured- See Also:
Serializer.asDOM3Serializer()
-
-