public final class ToUnknownStream extends SerializerBase
Modifier and Type | Field and Description |
---|---|
static String |
CDATA_CONTINUE
To insert ]]> in a CDATA section by ending the last CDATA section with
]] and starting the next CDATA section with >
|
static String |
CDATA_DELIMITER_CLOSE
The constant "]]>"
|
static String |
CDATA_DELIMITER_OPEN |
static String |
DEFAULT_SAX_SERIALIZER |
static String |
ENTITY_AMP |
static String |
ENTITY_CRLF |
static String |
ENTITY_GT |
static String |
ENTITY_LT |
static String |
ENTITY_QUOT |
static String |
XML_PREFIX |
static String |
XMLNS_PREFIX |
static String |
XMLNS_URI |
static String |
XMLVERSION10 |
static String |
XMLVERSION11
Define the XML version.
|
m_attrBuff, m_attributes, m_CdataElems, m_cdataTagOpen, m_charsBuff, m_doctypePublic, m_doctypeSystem, m_doIndent, m_elemContext, m_indentAmount, m_inEntityRef, m_inExternalDTD, m_mediatype, m_prefixMap, m_shouldNotWriteXMLHeader, m_sourceLocator, m_standaloneWasSpecified, m_StringOfCDATASections, m_tracer, m_version, m_writer, PKG_NAME, PKG_PATH
HTML_ATTREMPTY, HTML_ATTRURL, NO_BAD_CHARS
Constructor and Description |
---|
ToUnknownStream()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String rawName,
String value)
Adds an attribute to the currenly open tag
|
void |
addAttribute(String uri,
String localName,
String rawName,
String type,
String value,
boolean XSLAttribute)
Adds an attribute to the currenly open tag
|
void |
addAttributes(Attributes atts)
Add the given attributes to the currently collected ones.
|
void |
addUniqueAttribute(String rawName,
String value,
int flags)
Adds a unique attribute to the currenly open tag
|
ContentHandler |
asContentHandler()
Return a
ContentHandler interface into this serializer. |
Object |
asDOM3Serializer()
Return a
DOM3Serializer interface into this serializer. |
DOMSerializer |
asDOMSerializer()
Return a
DOMSerializer interface into this serializer. |
void |
attributeDecl(String arg0,
String arg1,
String arg2,
String arg3,
String arg4)
Pass the call on to the underlying handler
|
void |
characters(char[] characters,
int offset,
int length)
Pass the call on to the underlying handler
|
void |
characters(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 handler
|
void |
comment(String comment)
Pass the call on to the underlying handler
|
void |
elementDecl(String arg0,
String arg1)
Pass the call on to the underlying handler
|
void |
endCDATA()
Pass the call on to the underlying handler
|
void |
endDocument()
Pass the call on to the underlying handler
|
void |
endDTD()
Pass the call on to the underlying handler
|
void |
endElement(String elementName)
Pass the call on to the underlying handler
|
void |
endElement(String namespaceURI,
String localName,
String qName)
Pass the call on to the underlying handler
|
void |
endEntity(String name)
Pass the call on to the underlying handler
|
void |
endPrefixMapping(String prefix)
Pass the call on to the underlying handler
|
void |
entityReference(String entityName)
Entity reference event.
|
void |
externalEntityDecl(String name,
String publicId,
String systemId)
Pass the call on to the underlying handler
|
protected void |
firePseudoElement(String elementName) |
void |
flushPending()
A SerializationHandler accepts SAX-like events, so
it can accumulate attributes or namespace nodes after
a startElement().
|
String |
getDoctypePublic()
Pass the call on to the underlying handler
|
String |
getDoctypeSystem()
Pass the call on to the underlying handler
|
String |
getEncoding()
Pass the call on to the underlying handler
|
boolean |
getIndent()
Pass the call on to the underlying handler
|
int |
getIndentAmount()
Pass the call on to the underlying handler
|
String |
getMediaType()
Pass the call on to the underlying handler
|
NamespaceMappings |
getNamespaceMappings()
Get the current namespace mappings.
|
String |
getNamespaceURI(String qname,
boolean isElement)
Returns the URI of an element or attribute.
|
String |
getNamespaceURIFromPrefix(String prefix)
Returns the URI of prefix (if any)
|
boolean |
getOmitXMLDeclaration()
Pass the call on to the underlying handler
|
Properties |
getOutputFormat()
Returns the output format properties for this serializer.
|
OutputStream |
getOutputStream()
Get the output stream where the events will be serialized to.
|
String |
getPrefix(String namespaceURI)
Returns the prefix currently pointing to the given URI (if any).
|
String |
getStandalone()
Pass the call on to the underlying handler
|
Transformer |
getTransformer()
Gets the transformer associated with this serializer
|
String |
getVersion()
Pass the call on to the underlying handler
|
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 handler
|
void |
internalEntityDecl(String arg0,
String arg1)
Pass the call on to the underlying handler
|
void |
namespaceAfterStartElement(String prefix,
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(String target,
String data)
Pass the call on to the underlying handler
|
boolean |
reset()
passes the call on to the underlying HTML or XML handler
|
void |
serialize(Node node)
Converts the DOM node to output
|
void |
setCdataSectionElements(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(String system,
String pub)
Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties
|
void |
setDoctypePublic(String doctype)
Set the doctype in the underlying XML handler.
|
void |
setDoctypeSystem(String doctype)
Set the doctype in the underlying XML handler.
|
void |
setDocumentLocator(Locator locator)
Pass the call on to the underlying handler
|
void |
setEncoding(String encoding)
Pass the call on to the underlying handler
|
boolean |
setEscaping(boolean escape)
Turns special character escaping on/off.
|
void |
setIndent(boolean indent)
Pass the call on to the underlying handler
|
void |
setIndentAmount(int value)
Pass the call on to the underlying handler
|
void |
setMediaType(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 handler
|
void |
setOutputFormat(Properties format)
Set the properties of the handler
|
void |
setOutputStream(OutputStream output)
Sets the output stream to write to
|
void |
setSourceLocator(SourceLocator locator)
This method is used to set the source locator, which might be used to
generated an error message.
|
void |
setStandalone(String standalone)
Pass the call on to the underlying handler
|
void |
setTransformer(Transformer t)
Sets the transformer associated with this serializer
|
void |
setVersion(String version)
This method cannot be cached because default is different in
HTML and XML (we need more than a boolean).
|
void |
setWriter(Writer writer)
Sets the writer to write to
|
void |
skippedEntity(String name)
Pass the call on to the underlying handler
|
void |
startCDATA()
Pass the call on to the underlying handler
|
void |
startDocument()
Receive notification of the beginning of a document.
|
void |
startDTD(String name,
String publicId,
String systemId)
Pass the call on to the underlying handler
|
void |
startElement(String qName)
This method is used to notify of the start of an element
|
void |
startElement(String namespaceURI,
String localName,
String qName)
This method is used to notify that an element is starting.
|
void |
startElement(String namespaceURI,
String localName,
String elementName,
Attributes atts) |
void |
startEntity(String name)
Pass the call on to the underlying handler
|
void |
startPrefixMapping(String prefix,
String uri) |
boolean |
startPrefixMapping(String prefix,
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.
|
addAttribute, addAttributeAlways, addXSLAttribute, characters, documentIsEmpty, error, fatalError, fireCDATAEvent, fireCharEvent, fireCommentEvent, fireEndDoc, fireEndElem, fireEndEntity, fireEntityReference, fireEscapingEvent, fireStartDoc, fireStartElem, fireStartEntity, getLocalName, getOutputProperty, getOutputPropertyDefault, getOutputPropertyNonDefault, getPrefixPart, initCDATA, isCdataSection, notationDecl, patchName, setDTDEntityExpansion, setNamespaceMappings, setOutputProperty, setOutputPropertyDefault, setStandaloneInternal, startDocumentInternal, unparsedEntityDecl, warning
public static final String CDATA_CONTINUE
public static final String CDATA_DELIMITER_CLOSE
public static final String CDATA_DELIMITER_OPEN
public static final String ENTITY_AMP
public static final String ENTITY_CRLF
public static final String ENTITY_GT
public static final String ENTITY_LT
public static final String ENTITY_QUOT
public static final String XML_PREFIX
public static final String XMLNS_PREFIX
public static final String XMLNS_URI
public static final String DEFAULT_SAX_SERIALIZER
public static final String XMLVERSION11
public static final String XMLVERSION10
public ToUnknownStream()
public ContentHandler asContentHandler() throws IOException
SerializerBase
ContentHandler
interface into this serializer.
If the serializer does not support the ContentHandler
interface, it should return null.asContentHandler
in interface Serializer
asContentHandler
in class SerializerBase
IOException
- An I/O exception occuredSerializer.asContentHandler()
public void close()
SerializerBase
close
in interface SerializationHandler
close
in class SerializerBase
SerializationHandler.close()
public Properties getOutputFormat()
Serializer
Serializer.getOutputFormat()
public OutputStream getOutputStream()
Serializer
Serializer.getOutputStream()
public Writer getWriter()
Serializer
Serializer.getWriter()
public boolean reset()
reset
in interface Serializer
reset
in class SerializerBase
Serializer.reset()
public void serialize(Node node) throws IOException
node
- the DOM node to transform to outputIOException
- if an I/O exception occured while serializingDOMSerializer.serialize(Node)
public boolean setEscaping(boolean escape) throws SAXException
SerializationHandler
escape
- true if escaping is to be set on.SAXException
SerializationHandler.setEscaping(boolean)
public void setOutputFormat(Properties format)
format
- the output properties to setSerializer.setOutputFormat(Properties)
public void setOutputStream(OutputStream output)
output
- the OutputStream to write toSerializer.setOutputStream(OutputStream)
public void setWriter(Writer writer)
writer
- the writer to write toSerializer.setWriter(Writer)
public void addAttribute(String uri, String localName, String rawName, String type, String value, boolean XSLAttribute) throws SAXException
addAttribute
in interface ExtendedContentHandler
addAttribute
in class SerializerBase
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 elementSAXException
ExtendedContentHandler.addAttribute(String, String, String, String, String)
public void addAttribute(String rawName, String value)
addAttribute
in interface ExtendedContentHandler
addAttribute
in class SerializerBase
rawName
- the attribute name, with prefix (if any)value
- the value of the parameterExtendedContentHandler.addAttribute(String, String)
public void addUniqueAttribute(String rawName, String value, int flags) throws SAXException
rawName
- the fully qualified attribute name.value
- the attribute valueflags
- a bitwise flagSAXException
public void characters(String chars) throws SAXException
chars
- the character dataSAXException
ExtendedContentHandler.characters(String)
public void endElement(String elementName) throws SAXException
elementName
- the fully qualified element name.SAXException
ExtendedContentHandler.endElement(String)
public void startPrefixMapping(String prefix, String uri) throws SAXException
prefix
- The prefix that maps to the URIuri
- The URI for the namespaceSAXException
ContentHandler.startPrefixMapping(String, String)
public void namespaceAfterStartElement(String prefix, String uri) throws SAXException
namespaceAfterStartElement
in interface ExtendedContentHandler
namespaceAfterStartElement
in class SerializerBase
uri
- the URI of the namespaceprefix
- the prefix associated with the given URI.SAXException
ExtendedContentHandler.namespaceAfterStartElement(String, String)
public boolean startPrefixMapping(String prefix, String uri, boolean shouldFlush) throws SAXException
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
public void setVersion(String version)
setVersion
in class SerializerBase
version
- the version of the output format.XSLOutputAttributes.setVersion(String)
public void startDocument() throws SAXException
SerializerBase
The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).
startDocument
in interface ContentHandler
startDocument
in class SerializerBase
SAXException
ContentHandler.startDocument()
public void startElement(String qName) throws SAXException
ExtendedContentHandler
qName
- the fully qualified name of the elementSAXException
public void startElement(String namespaceURI, String localName, String qName) throws SAXException
ExtendedContentHandler
startElement(uri,localName,qname,atts)but without the attributes.
namespaceURI
- the namespace URI of the elementlocalName
- the local name (without prefix) of the elementqName
- the qualified name of the elementSAXException
public void startElement(String namespaceURI, String localName, String elementName, Attributes atts) throws SAXException
SAXException
public void comment(String comment) throws 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.SAXException
ExtendedLexicalHandler.comment(String)
public String getDoctypePublic()
getDoctypePublic
in class SerializerBase
XSLOutputAttributes.getDoctypePublic()
public String getDoctypeSystem()
getDoctypeSystem
in class SerializerBase
XSLOutputAttributes.getDoctypeSystem()
public String getEncoding()
getEncoding
in class SerializerBase
XSLOutputAttributes.getEncoding()
public boolean getIndent()
getIndent
in class SerializerBase
XSLOutputAttributes.getIndent()
public int getIndentAmount()
getIndentAmount
in class SerializerBase
XSLOutputAttributes.getIndentAmount()
public String getMediaType()
getMediaType
in class SerializerBase
XSLOutputAttributes.getMediaType()
public boolean getOmitXMLDeclaration()
getOmitXMLDeclaration
in class SerializerBase
XSLOutputAttributes.getOmitXMLDeclaration()
public String getStandalone()
getStandalone
in class SerializerBase
standalone
delaration is to
be included in the output document.XSLOutputAttributes.getStandalone()
public String getVersion()
getVersion
in class SerializerBase
XSLOutputAttributes.getVersion()
public void setDoctype(String system, String pub)
SerializerBase
setDoctype
in class SerializerBase
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(String, String)
public void setDoctypePublic(String doctype)
setDoctypePublic
in class SerializerBase
doctype
- the public doctype to setXSLOutputAttributes.setDoctypePublic(String)
public void setDoctypeSystem(String doctype)
setDoctypeSystem
in class SerializerBase
doctype
- the system doctype to setXSLOutputAttributes.setDoctypeSystem(String)
public void setEncoding(String encoding)
setEncoding
in class SerializerBase
encoding
- the character encodingXSLOutputAttributes.setEncoding(String)
public void setIndent(boolean indent)
setIndent
in class SerializerBase
indent
- true if the output document should be indented to
visually indicate its structure.XSLOutputAttributes.setIndent(boolean)
public void setIndentAmount(int value)
setIndentAmount
in interface SerializationHandler
setIndentAmount
in class SerializerBase
value
- The m_indentAmount to setpublic void setMediaType(String mediaType)
SerializerBase
setMediaType
in class SerializerBase
mediaType
- the non-null media-type or MIME type associated with the
output document.XSLOutputAttributes.setMediaType(String)
public void setOmitXMLDeclaration(boolean b)
setOmitXMLDeclaration
in class SerializerBase
b
- true if the XML declaration is to be omitted from the output
document.XSLOutputAttributes.setOmitXMLDeclaration(boolean)
public void setStandalone(String standalone)
setStandalone
in class SerializerBase
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.XSLOutputAttributes.setStandalone(String)
public void attributeDecl(String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException
public void elementDecl(String arg0, String arg1) throws SAXException
SAXException
DeclHandler.elementDecl(String, String)
public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException
SAXException
DeclHandler.externalEntityDecl(String, String, String)
public void internalEntityDecl(String arg0, String arg1) throws SAXException
SAXException
DeclHandler.internalEntityDecl(String, String)
public void characters(char[] characters, int offset, int length) throws SAXException
SAXException
ContentHandler.characters(char[], int, int)
public void endDocument() throws SAXException
SAXException
ContentHandler.endDocument()
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
SAXException
ContentHandler.endElement(String, String, String)
public void endPrefixMapping(String prefix) throws SAXException
SAXException
ContentHandler.endPrefixMapping(String)
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
SAXException
ContentHandler.ignorableWhitespace(char[], int, int)
public void processingInstruction(String target, String data) throws SAXException
SAXException
ContentHandler.processingInstruction(String, String)
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class SerializerBase
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.
ContentHandler.setDocumentLocator(Locator)
public void skippedEntity(String name) throws SAXException
SAXException
ContentHandler.skippedEntity(String)
public void comment(char[] ch, int start, int length) throws SAXException
SAXException
LexicalHandler.comment(char[], int, int)
public void endCDATA() throws SAXException
SAXException
LexicalHandler.endCDATA()
public void endDTD() throws SAXException
SAXException
LexicalHandler.endDTD()
public void endEntity(String name) throws SAXException
endEntity
in interface LexicalHandler
endEntity
in class SerializerBase
name
- The name of the entity that is ending.SAXException
- The application may raise an exception.LexicalHandler.endEntity(String)
public void startCDATA() throws SAXException
SAXException
LexicalHandler.startCDATA()
public void startDTD(String name, String publicId, String systemId) throws SAXException
SAXException
LexicalHandler.startDTD(String, String, String)
public void startEntity(String name) throws SAXException
SAXException
LexicalHandler.startEntity(String)
public DOMSerializer asDOMSerializer() throws IOException
SerializerBase
DOMSerializer
interface into this serializer. If the
serializer does not support the DOMSerializer
interface, it should
return null.asDOMSerializer
in interface Serializer
asDOMSerializer
in class SerializerBase
DOMSerializer
interface into this serializer, or null
if the serializer is not DOM capableIOException
- An I/O exception occuredSerializer.asDOMSerializer()
public void setCdataSectionElements(Vector URI_and_localNames)
URI_and_localNames
- Vector a list of pairs of URI/localName
specified in the cdata-section-elements attribute.XSLOutputAttributes.setCdataSectionElements(java.util.Vector)
public void addAttributes(Attributes atts) throws SAXException
SerializerBase
addAttributes
in interface ExtendedContentHandler
addAttributes
in class SerializerBase
atts
- List of attributes to add to this listSAXException
ExtendedContentHandler.addAttributes(org.xml.sax.Attributes)
public NamespaceMappings getNamespaceMappings()
getNamespaceMappings
in interface ExtendedContentHandler
getNamespaceMappings
in class SerializerBase
ExtendedContentHandler.getNamespaceMappings()
public void flushPending() throws SAXException
SerializationHandler
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.
SAXException
SerializationHandler.flushPending()
public String getPrefix(String namespaceURI)
SerializerBase
getPrefix
in interface ExtendedContentHandler
getPrefix
in class SerializerBase
namespaceURI
- the uri of the namespace in questionExtendedContentHandler.getPrefix(java.lang.String)
public void entityReference(String entityName) throws SAXException
SerializerBase
entityReference
in interface ExtendedContentHandler
entityReference
in class SerializerBase
entityName
- Name of entitySAXException
ExtendedContentHandler.entityReference(java.lang.String)
public String getNamespaceURI(String qname, boolean isElement)
SerializerBase
getNamespaceURI
in interface ExtendedContentHandler
getNamespaceURI
in class SerializerBase
qname
- a qualified nameisElement
- true if the qualified name is the name of
an element.ExtendedContentHandler.getNamespaceURI(java.lang.String, boolean)
public String getNamespaceURIFromPrefix(String prefix)
SerializerBase
getNamespaceURIFromPrefix
in interface ExtendedContentHandler
getNamespaceURIFromPrefix
in class SerializerBase
prefix
- the prefix whose URI is searched forpublic void setTransformer(Transformer t)
SerializerBase
setTransformer
in interface SerializationHandler
setTransformer
in class SerializerBase
t
- the transformer associated with this serializer.SerializationHandler.setTransformer(Transformer)
public Transformer getTransformer()
SerializerBase
getTransformer
in interface SerializationHandler
getTransformer
in class SerializerBase
SerializationHandler.getTransformer()
public void setContentHandler(ContentHandler ch)
SerializationHandler
public void setSourceLocator(SourceLocator locator)
setSourceLocator
in interface ExtendedContentHandler
setSourceLocator
in class SerializerBase
locator
- the source locatorExtendedContentHandler.setSourceLocator(javax.xml.transform.SourceLocator)
protected void firePseudoElement(String elementName)
public Object asDOM3Serializer() throws IOException
SerializerBase
DOM3Serializer
interface into this serializer. If the
serializer does not support the DOM3Serializer
interface, it should
return null.asDOM3Serializer
in interface Serializer
asDOM3Serializer
in class SerializerBase
DOM3Serializer
interface into this serializer, or null
if the serializer is not DOM capableIOException
- An I/O exception occuredSerializer.asDOM3Serializer()
Copyright © 2017 JBoss by Red Hat. All rights reserved.