public class XMLSAXSerializer extends DefaultHandler implements ContentHandler, LexicalHandler, DeclHandler, DTDHandler, EntityResolver, ErrorHandler
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ENCODING
Deprecated.
Output encoding property
|
static java.lang.String |
INDENT
Deprecated.
Output Indenting
|
static java.lang.String |
OMIT_XML_DECL
Deprecated.
Print XML Declaration
|
| Constructor and Description |
|---|
XMLSAXSerializer(java.io.OutputStream os)
Deprecated.
Create a XMLSAXSerializer to print the XML to the given OutputStream
|
XMLSAXSerializer(java.io.PrintWriter pw)
Deprecated.
Create a XMLSAXSerializer to print the XML to the given PrintWriter
|
| Modifier and Type | Method and Description |
|---|---|
void |
attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String mode, java.lang.String value)
Deprecated.
Report an attribute type declaration.
|
void |
characters(char[] ch, int start, int length)
Deprecated.
Receive notification of character data inside an element.
|
void |
comment(char[] ch, int start, int length)
Deprecated.
Report an XML comment anywhere in the document.
|
void |
elementDecl(java.lang.String name, java.lang.String model)
Deprecated.
Report an element type declaration.
|
void |
endCDATA()
Deprecated.
Report the end of a CDATA section.
|
void |
endDocument()
Deprecated.
Receive notification of the end of the document.
|
void |
endDTD()
Deprecated.
Report the end of DTD declarations.
|
void |
endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
Deprecated.
Receive notification of the end of an element.
|
void |
endEntity(java.lang.String name)
Deprecated.
Report the end of an entity.
|
void |
externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
Deprecated.
Report a parsed external entity declaration.
|
void |
flush()
Deprecated.
Flushes the output stream or print writer
|
void |
internalEntityDecl(java.lang.String name, java.lang.String value)
Deprecated.
Report an internal entity declaration.
|
void |
notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
Deprecated.
Receive notification of a notation declaration.
|
void |
processingInstruction(java.lang.String target, java.lang.String data)
Deprecated.
Receive notification of a processing instruction.
|
void |
setDocumentLocator(Locator loc)
Deprecated.
Receive a Locator object for document events.
|
void |
setProperty(java.lang.String property, java.lang.Object value)
Deprecated.
Set output printing properties
|
void |
startCDATA()
Deprecated.
Report the start of a CDATA section.
|
void |
startDocument()
Deprecated.
Receive notification of the beginning of the document.
|
void |
startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
Deprecated.
Report the start of DTD declarations, if any.
|
void |
startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts)
Deprecated.
Receive notification of the beginning of an element.
|
void |
startEntity(java.lang.String name)
Deprecated.
Report the beginning of some internal and external XML entities.
|
void |
unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
Deprecated.
Receive notification of an unparsed entity declaration.
|
endPrefixMapping, error, fatalError, ignorableWhitespace, resolveEntity, skippedEntity, startPrefixMapping, warningequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitendPrefixMapping, ignorableWhitespace, skippedEntity, startPrefixMappingresolveEntityerror, fatalError, warningpublic static final java.lang.String ENCODING
public static final java.lang.String INDENT
public static final java.lang.String OMIT_XML_DECL
public XMLSAXSerializer(java.io.PrintWriter pw)
pw - PrintWriterpublic XMLSAXSerializer(java.io.OutputStream os)
os - OutputStream
public void setProperty(java.lang.String property,
java.lang.Object value)
property -value - of the propertypublic void setDocumentLocator(Locator loc)
DefaultHandlerBy default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.
setDocumentLocator in interface ContentHandlersetDocumentLocator in class DefaultHandlerloc - A locator for all SAX document events.ContentHandler.setDocumentLocator(org.xml.sax.Locator), Locator
public void flush()
throws java.io.IOException
java.io.IOException
public void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class DefaultHandlerSAXException - Any SAX exception, possibly wrapping another exception.ContentHandler.startDocument()
public void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class DefaultHandlerSAXException - Any SAX exception, possibly wrapping another exception.ContentHandler.endDocument()
public void startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
Attributes atts)
throws SAXException
startElement in interface ContentHandlerstartElement in class DefaultHandleruri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.qName - The qualified name (with prefix), or the empty string if qualified names are not available.atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.SAXException - Any SAX exception, possibly wrapping another exception.endElement(java.lang.String, java.lang.String, java.lang.String), Attributes
public void endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
throws SAXException
endElement in interface ContentHandlerendElement in class DefaultHandleruri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.qName - The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.SAXException - Any SAX exception, possibly wrapping another exception.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void processingInstruction(java.lang.String target,
java.lang.String data)
throws SAXException
processingInstruction in interface ContentHandlerprocessingInstruction in class DefaultHandlertarget - The processing instruction target.data - The processing instruction data, or null if none is supplied.SAXException - Any SAX exception, possibly wrapping another exception.DocumentHandler.processingInstruction(java.lang.String, java.lang.String)
public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class DefaultHandlerch - The characters.start - The start position in the character array.length - The number of characters to use from the character array.SAXException - Any SAX exception, possibly wrapping another exception.DocumentHandler.characters(char[], int, int)
public void startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws SAXException
startDTD in interface LexicalHandlername - The document type name.publicId - The declared public identifier for the external DTD subset, or null if none was declared.systemId - The declared system identifier for the external DTD subset, or null if none was declared.SAXException - The application may raise an exception.endDTD(), startEntity(java.lang.String)
public void endDTD()
throws SAXException
This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.
endDTD in interface LexicalHandlerSAXException - The application may raise an exception.startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startEntity(java.lang.String name)
throws SAXException
startEntity in interface LexicalHandlername - The name of the entity.SAXException - The application may raise an exception.endEntity(java.lang.String), DeclHandler.internalEntityDecl(java.lang.String, java.lang.String), DeclHandler.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
public void endEntity(java.lang.String name)
throws SAXException
endEntity in interface LexicalHandlername - The name of the entity that is ending.SAXException - The application may raise an exception.startEntity(java.lang.String)
public void startCDATA()
throws SAXException
The contents of the CDATA section will be reported through the regular characters event; this event is intended only to report the boundary.
startCDATA in interface LexicalHandlerSAXException - The application may raise an exception.endCDATA()
public void endCDATA()
throws SAXException
endCDATA in interface LexicalHandlerSAXException - The application may raise an exception.startCDATA()
public void comment(char[] ch,
int start,
int length)
throws SAXException
comment in interface LexicalHandlerch - An array holding the characters in the comment.start - The starting position in the array.length - The number of characters to use from the array.SAXException - The application may raise an exception.
public void elementDecl(java.lang.String name,
java.lang.String model)
throws SAXException
The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all parameter entities are fully resolved and all whitespace is removed, and will include the enclosing parentheses. Other normalization (such as removing redundant parentheses or simplifying occurrence indicators) is at the discretion of the parser.
elementDecl in interface DeclHandlername - The element type name.model - The content model as a normalized string.SAXException - The application may raise an exception.
public void attributeDecl(java.lang.String eName,
java.lang.String aName,
java.lang.String type,
java.lang.String mode,
java.lang.String value)
throws SAXException
Only the effective (first) declaration for an attribute will be reported. The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", a parenthesized token group with the separator "|" and all whitespace removed, or the word "NOTATION" followed by a space followed by a parenthesized token group with all whitespace removed.
The value will be the value as reported to applications, appropriately normalized and with entity and character references expanded.
attributeDecl in interface DeclHandlereName - The name of the associated element.aName - The name of the attribute.type - A string representing the attribute type.mode - A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.value - A string representing the attribute's default value, or null if there is none.SAXException - The application may raise an exception.
public void internalEntityDecl(java.lang.String name,
java.lang.String value)
throws SAXException
Only the effective (first) declaration for each entity will be reported. All parameter entities in the value will be expanded, but general entities will not.
internalEntityDecl in interface DeclHandlername - The name of the entity. If it is a parameter entity, the name will begin with '%'.value - The replacement text of the entity.SAXException - The application may raise an exception.externalEntityDecl(java.lang.String, java.lang.String, java.lang.String), DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void externalEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws SAXException
Only the effective (first) declaration for each entity will be reported.
If the system identifier is a URL, the parser must resolve it fully before passing it to the application.
externalEntityDecl in interface DeclHandlername - The name of the entity. If it is a parameter entity, the name will begin with '%'.publicId - The entity's public identifier, or null if none was given.systemId - The entity's system identifier.SAXException - The application may raise an exception.internalEntityDecl(java.lang.String, java.lang.String), DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void notationDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
throws SAXException
DefaultHandlerBy default, do nothing. Application writers may override this method in a subclass if they wish to keep track of the notations declared in a document.
notationDecl in interface DTDHandlernotationDecl in class DefaultHandlername - The notation name.publicId - The notation public identifier, or null if not available.systemId - The notation system identifier.SAXException - Any SAX exception, possibly wrapping another exception.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
public void unparsedEntityDecl(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName)
throws SAXException
DefaultHandlerBy default, do nothing. Application writers may override this method in a subclass to keep track of the unparsed entities declared in a document.
unparsedEntityDecl in interface DTDHandlerunparsedEntityDecl in class DefaultHandlername - The entity name.publicId - The entity public identifier, or null if not available.systemId - The entity system identifier.notationName - The name of the associated notation.SAXException - Any SAX exception, possibly wrapping another exception.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)