|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface is the one that a serializer implements. It is a group of other interfaces, such as ExtendedContentHandler, ExtendedLexicalHandler etc. In addition there are other methods, such as reset(). This class is public only because it is used in another package, it is not a public API.
| Field Summary | |
static int |
HTML_ATTREMPTY
|
static int |
HTML_ATTRURL
|
static int |
NO_BAD_CHARS
|
| Method Summary | |
void |
addAttribute(String qName,
String value)
Add an attribute to the current element. |
void |
addAttribute(String uri,
String localName,
String rawName,
String type,
String value)
Add at attribute to the current element, not from an xsl:attribute element. |
void |
addAttribute(String uri,
String localName,
String rawName,
String type,
String value,
boolean XSLAttribute)
Add at attribute to the current element |
void |
addAttributes(Attributes atts)
Add attributes to the current element |
void |
addUniqueAttribute(String qName,
String value,
int flags)
Add a unique attribute to the current element. |
void |
addXSLAttribute(String qName,
String value,
String uri)
Add an attribute from an xsl:attribute element. |
void |
characters(Node node)
This method is used to notify of a character event, but passing the data as a DOM Node rather than the standard character array. |
void |
characters(String chars)
This method is used to notify of a character event, but passing the data as a character String rather than the standard character array. |
void |
close()
|
void |
comment(String comment)
This method is used to notify of a comment |
void |
endElement(String elemName)
This method is used to notify that an element has ended. |
void |
entityReference(String entityName)
Notify of an entity reference. |
void |
flushPending()
Flush any pending events currently queued up in the serializer. |
String |
getDoctypePublic()
Returns the previously set value of the value to be used as the public identifier in the document type declaration (DTD). |
String |
getDoctypeSystem()
Returns the previously set value of the value to be used as the system identifier in the document type declaration (DTD). |
String |
getEncoding()
|
boolean |
getIndent()
|
int |
getIndentAmount()
|
String |
getMediaType()
|
NamespaceMappings |
getNamespaceMappings()
This method returns an object that has the current namespace mappings in effect. |
String |
getNamespaceURI(String name,
boolean isElement)
This method gets the prefix associated with a current element or attribute name. |
String |
getNamespaceURIFromPrefix(String prefix)
This method returns the namespace URI currently associated with the prefix. |
boolean |
getOmitXMLDeclaration()
|
String |
getPrefix(String uri)
This method returns the prefix that currently maps to the given namespace URI. |
String |
getStandalone()
|
Transformer |
getTransformer()
Get the transformer associated with the serializer. |
String |
getVersion()
|
void |
namespaceAfterStartElement(String uri,
String prefix)
This method is used to notify that a prefix mapping is to start, but after an element is started. |
void |
serialize(Node node)
Notify that the serializer should take this DOM node as input to be serialized. |
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 value coming from the xsl:output doctype-public stylesheet attribute. |
void |
setDoctypeSystem(String doctype)
Set the value coming from the xsl:output doctype-system stylesheet attribute. |
void |
setDTDEntityExpansion(boolean expand)
Default behavior is to expand DTD entities, that is the initall default value is true. |
void |
setEncoding(String encoding)
Sets the character encoding coming from the xsl:output encoding stylesheet attribute. |
boolean |
setEscaping(boolean escape)
Turns special character escaping on/off. |
void |
setIndent(boolean indent)
Sets the value coming from the xsl:output indent stylesheet attribute. |
void |
setIndentAmount(int spaces)
Set the number of spaces to indent for each indentation level. |
void |
setMediaType(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 |
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)
Sets the value coming from the xsl:output standalone stylesheet attribute. |
void |
setTransformer(Transformer transformer)
Set the transformer associated with the serializer. |
void |
setVersion(String version)
Sets the value coming from the xsl:output version attribute. |
void |
startElement(String qName)
This method is used to notify of the start of an element |
void |
startElement(String uri,
String localName,
String qName)
This method is used to notify that an element is starting. |
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. |
| Methods inherited from interface org.xml.sax.ContentHandler |
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping |
| Methods inherited from interface org.xml.sax.ext.LexicalHandler |
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity |
| Methods inherited from interface org.xml.sax.ext.DeclHandler |
attributeDecl, elementDecl, externalEntityDecl, internalEntityDecl |
| Methods inherited from interface org.xml.sax.DTDHandler |
notationDecl, unparsedEntityDecl |
| Methods inherited from interface org.xml.sax.ErrorHandler |
error, fatalError, warning |
| Methods inherited from interface org.apache.xml.serializer.Serializer |
asContentHandler, asDOMSerializer, getOutputFormat, getOutputStream, getWriter, reset, setOutputFormat, setOutputStream, setWriter |
| Field Detail |
public static final int NO_BAD_CHARS
public static final int HTML_ATTREMPTY
public static final int HTML_ATTRURL
| Method Detail |
public void setContentHandler(ContentHandler ch)
Serializer.asContentHandler(),
ToSAXHandlerpublic void close()
public void serialize(Node node)
throws IOException
serialize in interface DOMSerializernode - the DOM node to be serialized.
IOException
public boolean setEscaping(boolean escape)
throws SAXException
escape - true if escaping is to be set on.
SAXExceptionpublic void setIndentAmount(int spaces)
spaces - the number of spaces to indent for each indentation level.public void setTransformer(Transformer transformer)
transformer - the transformer associated with the serializer.public Transformer getTransformer()
public void setNamespaceMappings(NamespaceMappings mappings)
mappings - NamespaceMappings
public void flushPending()
throws SAXException
SAXExceptionpublic void setDTDEntityExpansion(boolean expand)
expand - true if DTD entities are to be expanded,
false if they are to be left as DTD entity references.
public void addAttribute(String uri,
String localName,
String rawName,
String type,
String value,
boolean XSLAttribute)
throws SAXException
uri - the namespace URI of the attribute namelocalName - the local name of the attribute (without prefix)rawName - the qualified name of the attributetype - the attribute type typically character data (CDATA)value - the value of the attributeXSLAttribute - true if the added attribute is coming from an xsl:attribute element
SAXException
public void addAttributes(Attributes atts)
throws SAXException
atts - the attributes to add.
SAXException
public void addAttribute(String qName,
String value)
qName - value -
public void characters(String chars)
throws SAXException
chars - the character data
SAXException
public void characters(Node node)
throws SAXException
node - a DOM Node containing text.
SAXException
public void endElement(String elemName)
throws SAXException
endElement(namespaceURI,localName,qName)only the last parameter is passed. If needed the serializer can derive the localName from the qualified name and derive the namespaceURI from its implementation.
elemName - the fully qualified element name.
SAXException
public void startElement(String uri,
String localName,
String qName)
throws SAXException
startElement(uri,localName,qname,atts)but without the attributes.
uri - the namespace URI of the elementlocalName - the local name (without prefix) of the elementqName - the qualified name of the element
SAXException
public void startElement(String qName)
throws SAXException
qName - the fully qualified name of the element
SAXException
public void namespaceAfterStartElement(String uri,
String prefix)
throws SAXException
startPrefixMapping(prefix,uri)is used just before an element starts and applies to the element to come, not to the current element. This method applies to the current element. For example one could make the calls in this order:
startElement("prfx8:elem9")
namespaceAfterStartElement("http://namespace8","prfx8")
uri - the namespace URI being declaredprefix - the prefix that maps to the given namespace
SAXException
public boolean startPrefixMapping(String prefix,
String uri,
boolean shouldFlush)
throws SAXException
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 entityReference(String entityName)
throws SAXException
entityName - the name of the entity
SAXExceptionpublic NamespaceMappings getNamespaceMappings()
public String getPrefix(String uri)
uri - the namespace URI
public String getNamespaceURI(String name,
boolean isElement)
name - the qualified name of an element, or attributeisElement - true if it is an element name, false if it is an
atttribute name
public String getNamespaceURIFromPrefix(String prefix)
prefix - a prefix of an element or attribute.
public void setSourceLocator(SourceLocator locator)
locator - the source locator
public void addUniqueAttribute(String qName,
String value,
int flags)
throws SAXException
qName - the fully qualified attribute name.value - the attribute valueflags - a bitwise flag
SAXException
public void addXSLAttribute(String qName,
String value,
String uri)
qName - the qualified attribute name (prefix:localName)value - the attributes valueuri - the uri that the prefix of the qName is mapped to.
public void addAttribute(String uri,
String localName,
String rawName,
String type,
String value)
throws SAXException
uri - the namespace URI of the attribute namelocalName - the local name of the attribute (without prefix)rawName - the qualified name of the attributetype - the attribute type typically character data (CDATA)value - the value of the attribute
SAXException
public void comment(String comment)
throws SAXException
comment - the comment, but unlike the SAX comment() method this
method takes a String rather than a character array.
SAXExceptionpublic String getDoctypePublic()
public String getDoctypeSystem()
public String getEncoding()
public boolean getIndent()
public int getIndentAmount()
public String getMediaType()
public boolean getOmitXMLDeclaration()
public String getStandalone()
standalone delaration is to
be included in the output document.public String getVersion()
public void setCdataSectionElements(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.
public void setDoctype(String system,
String pub)
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.public void setDoctypePublic(String doctype)
doctype - the public identifier to be used in the DOCTYPE
declaration in the output document.public void setDoctypeSystem(String doctype)
doctype - the system identifier to be used in the DOCTYPE
declaration in the output document.public void setEncoding(String encoding)
encoding - the character encodingpublic void setIndent(boolean indent)
indent - true if the output document should be indented to visually
indicate its structure.public void setMediaType(String mediatype)
mediatype - the media-type or MIME type associated with the output
document.public void setOmitXMLDeclaration(boolean b)
b - true if the XML declaration is to be omitted from the output
document.public void setStandalone(String standalone)
standalone - a value of "yes" indicates that the
standalone delaration is to be included in the output
document.public void setVersion(String version)
version - the version of the output format.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||