diff --git a/xerces-1_4_4/docs/html/apiDocs/org/apache/xml/serialize/BaseMarkupSerializer.html b/xerces-1_4_4/docs/html/apiDocs/org/apache/xml/serialize/BaseMarkupSerializer.html new file mode 100644 index 0000000..2af1656 --- /dev/null +++ b/xerces-1_4_4/docs/html/apiDocs/org/apache/xml/serialize/BaseMarkupSerializer.html @@ -0,0 +1,2030 @@ + + + +
+ +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.BaseMarkupSerializer ++
+Base class for a serializer supporting both DOM and SAX pretty + serializing of XML/HTML/XHTML documents. Derives classes perform + the method-specific serializing, this class provides the common + serializing mechanisms. +
+ The serializer must be initialized with the proper writer and
+ output format before it can be used by calling #init
.
+ The serializer can be reused any number of times, but cannot
+ be used concurrently by two threads.
+
+ If an output stream is used, the encoding is taken from the + output format (defaults to UTF-8). If a writer is + used, make sure the writer uses the same encoding (if applies) + as specified in the output format. +
+ The serializer supports both DOM and SAX. DOM serializing is done
+ by calling serialize(org.w3c.dom.Element)
and SAX serializing is done by firing
+ SAX events and using the serializer as a document handler.
+ This also applies to derived class.
+
+ If an I/O exception occurs while serializing, the serializer
+ will not throw an exception directly, but only throw it
+ at the end of serializing (either DOM or SAX's DocumentHandler.endDocument()
.
+
+ For elements that are not specified as whitespace preserving, + the serializer will potentially break long text lines at space + boundaries, indent lines, and serialize elements on separate + lines. Line terminators will be regarded as spaces, and + spaces at beginning of line will be stripped. +
+ When indenting, the serializer is capable of detecting seemingly + element content, and serializing these elements indented on separate + lines. An element is serialized indented when it is the first or + last child of an element, or immediate following or preceding + another element. +
+
Serializer
,
+DOMSerializer
+Field Summary | +|
+protected java.lang.String |
+_docTypePublicId
+
++ The system identifier of the document type, if known. |
+
+protected java.lang.String |
+_docTypeSystemId
+
++ The system identifier of the document type, if known. |
+
+protected OutputFormat |
+_format
+
++ The output format associated with this serializer. |
+
+protected boolean |
+_indenting
+
++ True if indenting printer. |
+
+protected java.util.Hashtable |
+_prefixes
+
++ Association between namespace URIs (keys) and prefixes (values). |
+
+protected Printer |
+_printer
+
++ The printer used for printing text parts. |
+
+protected boolean |
+_started
+
++ If the document has been started (header serialized), this + flag is set to true so it's not started twice. |
+
+Constructor Summary | +|
+protected |
+BaseMarkupSerializer(OutputFormat format)
+
++ Protected constructor can only be used by derived class. |
+
+Method Summary | +|
+ ContentHandler |
+asContentHandler()
+
++ Return a ContentHandler interface into this serializer. |
+
+ DocumentHandler |
+asDocumentHandler()
+
++ Return a DocumentHandler interface into this serializer. |
+
+ DOMSerializer |
+asDOMSerializer()
+
++ Return a DOMSerializer interface into this serializer. |
+
+ void |
+attributeDecl(java.lang.String eName,
+ java.lang.String aName,
+ java.lang.String type,
+ java.lang.String valueDefault,
+ java.lang.String value)
+
++ Report an attribute type declaration. |
+
+ void |
+characters(char[] chars,
+ int start,
+ int length)
+
++ Receive notification of character data. |
+
+protected void |
+characters(java.lang.String text)
+
++ Called to print the text contents in the prevailing element format. |
+
+ void |
+comment(char[] chars,
+ int start,
+ int length)
+
++ Report an XML comment anywhere in the document. |
+
+ void |
+comment(java.lang.String text)
+
++ |
+
+protected ElementState |
+content()
+
++ Must be called by a method about to print any type of content. |
+
+ void |
+elementDecl(java.lang.String name,
+ java.lang.String model)
+
++ Report an element type declaration. |
+
+ void |
+endCDATA()
+
++ Report the end of a CDATA section. |
+
+ void |
+endDocument()
+
++ Called at the end of the document to wrap it up. |
+
+ void |
+endDTD()
+
++ Report the end of DTD declarations. |
+
+ void |
+endEntity(java.lang.String name)
+
++ Report the end of an entity. |
+
+ void |
+endNonEscaping()
+
++ |
+
+ void |
+endPrefixMapping(java.lang.String prefix)
+
++ End the scope of a prefix-URI mapping. |
+
+ void |
+endPreserving()
+
++ |
+
+protected ElementState |
+enterElementState(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName,
+ boolean preserveSpace)
+
++ Enter a new element state for the specified element. |
+
+ void |
+externalEntityDecl(java.lang.String name,
+ java.lang.String publicId,
+ java.lang.String systemId)
+
++ Report a parsed external entity declaration. |
+
+protected ElementState |
+getElementState()
+
++ Return the state of the current element. |
+
+protected abstract java.lang.String |
+getEntityRef(int ch)
+
++ Returns the suitable entity reference for this character value, + or null if no such entity exists. |
+
+protected java.lang.String |
+getPrefix(java.lang.String namespaceURI)
+
++ Returns the namespace prefix for the specified URI. |
+
+ void |
+ignorableWhitespace(char[] chars,
+ int start,
+ int length)
+
++ Receive notification of ignorable whitespace in element content. |
+
+ void |
+internalEntityDecl(java.lang.String name,
+ java.lang.String value)
+
++ Report an internal entity declaration. |
+
+protected boolean |
+isDocumentState()
+
++ Returns true if in the state of the document. |
+
+protected ElementState |
+leaveElementState()
+
++ Leave the current element state and return to the + state of the parent element. |
+
+ void |
+notationDecl(java.lang.String name,
+ java.lang.String publicId,
+ java.lang.String systemId)
+
++ Receive notification of a notation declaration event. |
+
+protected void |
+prepare()
+
++ |
+
+protected void |
+printDoctypeURL(java.lang.String url)
+
++ Print a document type public or system identifier URL. |
+
+protected void |
+printEscaped(int ch)
+
++ |
+
+protected void |
+printEscaped(java.lang.String source)
+
++ Escapes a string so it may be printed as text content or attribute + value. |
+
+protected void |
+printText(char[] chars,
+ int start,
+ int length,
+ boolean preserveSpace,
+ boolean unescaped)
+
++ Called to print additional text with whitespace handling. |
+
+protected void |
+printText(java.lang.String text,
+ boolean preserveSpace,
+ boolean unescaped)
+
++ |
+
+ void |
+processingInstruction(java.lang.String target,
+ java.lang.String code)
+
++ Receive notification of a processing instruction. |
+
+ void |
+processingInstructionIO(java.lang.String target,
+ java.lang.String code)
+
++ |
+
+ boolean |
+reset()
+
++ |
+
+ void |
+serialize(Document doc)
+
++ Serializes the DOM document using the previously specified + writer and output format. |
+
+ void |
+serialize(DocumentFragment frag)
+
++ Serializes the DOM document fragmnt using the previously specified + writer and output format. |
+
+ void |
+serialize(Element elem)
+
++ Serializes the DOM element using the previously specified + writer and output format. |
+
+protected abstract void |
+serializeElement(Element elem)
+
++ Called to serializee the DOM element. |
+
+protected void |
+serializeNode(Node node)
+
++ Serialize the DOM node. |
+
+protected void |
+serializePreRoot()
+
++ Comments and PIs cannot be serialized before the root element, + because the root element serializes the document type, which + generally comes first. |
+
+ void |
+setDocumentLocator(Locator locator)
+
++ Receive an object for locating the origin of SAX document events. |
+
+ void |
+setOutputByteStream(java.io.OutputStream output)
+
++ Specifies an output stream to which the document should be + serialized. |
+
+ void |
+setOutputCharStream(java.io.Writer writer)
+
++ Specifies a writer to which the document should be serialized. |
+
+ void |
+setOutputFormat(OutputFormat format)
+
++ Specifies an output format for this serializer. |
+
+ void |
+skippedEntity(java.lang.String name)
+
++ Receive notification of a skipped entity. |
+
+ void |
+startCDATA()
+
++ Report the start of a CDATA section. |
+
+ void |
+startDocument()
+
++ Receive notification of the beginning of a document. |
+
+ void |
+startDTD(java.lang.String name,
+ java.lang.String publicId,
+ java.lang.String systemId)
+
++ Report the start of DTD declarations, if any. |
+
+ void |
+startEntity(java.lang.String name)
+
++ Report the beginning of some internal and external XML entities. |
+
+ void |
+startNonEscaping()
+
++ |
+
+ void |
+startPrefixMapping(java.lang.String prefix,
+ java.lang.String uri)
+
++ Begin the scope of a prefix-URI Namespace mapping. |
+
+ void |
+startPreserving()
+
++ |
+
+ void |
+unparsedEntityDecl(java.lang.String name,
+ java.lang.String publicId,
+ java.lang.String systemId,
+ java.lang.String notationName)
+
++ Receive notification of an unparsed entity declaration event. |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Field Detail | +
+protected boolean _started+
+protected java.util.Hashtable _prefixes+
+protected java.lang.String _docTypePublicId+
+protected java.lang.String _docTypeSystemId+
+protected OutputFormat _format+
+protected Printer _printer+
+protected boolean _indenting+
+Constructor Detail | +
+protected BaseMarkupSerializer(OutputFormat format)+
#init
.+Method Detail | +
+public DocumentHandler asDocumentHandler() + throws java.io.IOException+
DocumentHandler
interface into this serializer.
+ If the serializer does not support the DocumentHandler
+ interface, it should return null.+public ContentHandler asContentHandler() + throws java.io.IOException+
ContentHandler
interface into this serializer.
+ If the serializer does not support the ContentHandler
+ interface, it should return null.+public DOMSerializer asDOMSerializer() + throws java.io.IOException+
DOMSerializer
interface into this serializer.
+ If the serializer does not support the DOMSerializer
+ interface, it should return null.+public void setOutputByteStream(java.io.OutputStream output)+
+public void setOutputCharStream(java.io.Writer writer)+
+public void setOutputFormat(OutputFormat format)+
format
- The output format to use+public boolean reset()+
+protected void prepare() + throws java.io.IOException+
+public void serialize(Element elem) + throws java.io.IOException+
elem
- The element to serialize+public void serialize(DocumentFragment frag) + throws java.io.IOException+
elem
- The element to serialize+public void serialize(Document doc) + throws java.io.IOException+
doc
- The document to serialize+public void startDocument() + throws SAXException+
The SAX parser will invoke this method only once, before any
+ other methods in this interface or in DTDHandler
(except for setDocumentLocator
).
ContentHandler.endDocument()
+public void characters(char[] chars, + int start, + int length) + throws SAXException+
The Parser will call this method to report each chunk of + character data. SAX parsers may return all contiguous character + data in a single chunk, or they may split it into several + chunks; however, all of the characters in any single event + must come from the same external entity so that the Locator + provides useful information.
+ +The application must not attempt to read from the array + outside of the specified range.
+ +Note that some parsers will report whitespace in element
+ content using the ignorableWhitespace
+ method rather than this one (validating parsers must
+ do so).
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.ContentHandler.ignorableWhitespace(char[], int, int)
,
+Locator
+public void ignorableWhitespace(char[] chars, + int start, + int length) + throws SAXException+
Validating Parsers must use this method to report each chunk + of whitespace in element content (see the W3C XML 1.0 recommendation, + section 2.10): non-validating parsers may also use this method + if they are capable of parsing and using content models.
+ +SAX parsers may return all contiguous whitespace in a single + chunk, or they may split it into several chunks; however, all of + the characters in any single event must come from the same + external entity, so that the Locator provides useful + information.
+ +The application must not attempt to read from the array + outside of the specified range.
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.ContentHandler.characters(char[], int, int)
+public final void processingInstruction(java.lang.String target, + java.lang.String code) + throws SAXException+
The Parser will invoke this method once for each processing + instruction found: note that processing instructions may occur + before or after the main document element.
+ +A SAX parser must never report an XML declaration (XML 1.0, + section 2.8) or a text declaration (XML 1.0, section 4.3.1) + using this method.
target
- The processing instruction target.data
- The processing instruction data, or null if
+ none was supplied. The data does not include any
+ whitespace separating it from the target.+public void processingInstructionIO(java.lang.String target, + java.lang.String code) + throws java.io.IOException+
+public void comment(char[] chars, + int start, + int length) + throws SAXException+
This callback will be used for comments inside or outside the + document element, including comments in the external DTD + subset (if read). Comments in the DTD must be properly + nested inside start/endDTD and start/endEntity events (if + used).
ch
- 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.+public void comment(java.lang.String text) + throws java.io.IOException+
+public void startCDATA()+
The contents of the CDATA section will be reported through
+ the regular characters
event; this event is intended only to report
+ the boundary.
LexicalHandler.endCDATA()
+public void endCDATA()+
LexicalHandler.startCDATA()
+public void startNonEscaping()+
+public void endNonEscaping()+
+public void startPreserving()+
+public void endPreserving()+
+public void endDocument() + throws SAXException+
+public void startEntity(java.lang.String name)+
The reporting of parameter entities (including
+ the external DTD subset) is optional, and SAX2 drivers that
+ support LexicalHandler may not support it; you can use the
+ http://xml.org/sax/features/lexical-handler/parameter-entities
+ feature to query or control the reporting of parameter entities.
General entities are reported with their regular names, + parameter entities have '%' prepended to their names, and + the external DTD subset has the pseudo-entity name "[dtd]".
+ +When a SAX2 driver is providing these events, all other
+ events must be properly nested within start/end entity
+ events. There is no additional requirement that events from
+ DeclHandler
or
+ DTDHandler
be properly ordered.
Note that skipped entities will be reported through the
+ skippedEntity
+ event, which is part of the ContentHandler interface.
Because of the streaming event model that SAX uses, some + entity boundaries cannot be reported under any + circumstances:
+ +These will be silently expanded, with no indication of where + the original entity boundaries were.
+ +Note also that the boundaries of character references (which + are not really entities anyway) are not reported.
+ +All start/endEntity events must be properly nested.
name
- The name of the entity. If it is a parameter
+ entity, the name will begin with '%', and if it is the
+ external DTD subset, it will be "[dtd]".LexicalHandler.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)+
name
- The name of the entity that is ending.LexicalHandler.startEntity(java.lang.String)
+public void setDocumentLocator(Locator locator)+
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 ContentHandler + 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.
locator
- An object that can return the location of
+ any SAX document event.Locator
+public void skippedEntity(java.lang.String name) + throws SAXException+
The Parser will invoke this method once for each entity
+ skipped. Non-validating processors may skip entities if they
+ have not seen the declarations (because, for example, the
+ entity was declared in an external DTD subset). All processors
+ may skip external entities, depending on the values of the
+ http://xml.org/sax/features/external-general-entities
+ and the
+ http://xml.org/sax/features/external-parameter-entities
+ properties.
name
- The name of the skipped entity. If it is a
+ parameter entity, the name will begin with '%', and if
+ it is the external DTD subset, it will be the string
+ "[dtd]".+public void startPrefixMapping(java.lang.String prefix, + java.lang.String uri) + throws SAXException+
The information from this event is not necessary for
+ normal Namespace processing: the SAX XML reader will
+ automatically replace prefixes for element and attribute
+ names when the http://xml.org/sax/features/namespaces
+ feature is true (the default).
There are cases, however, when applications need to + use prefixes in character data or in attribute values, + where they cannot safely be expanded automatically; the + start/endPrefixMapping event supplies the information + to the application to expand prefixes in those contexts + itself, if necessary.
+ +Note that start/endPrefixMapping events are not
+ guaranteed to be properly nested relative to each-other:
+ all startPrefixMapping events will occur before the
+ corresponding startElement
event,
+ and all endPrefixMapping
+ events will occur after the corresponding endElement
event, but their order is not otherwise
+ guaranteed.
There should never be start/endPrefixMapping events for the + "xml" prefix, since it is predeclared and immutable.
prefix
- The Namespace prefix being declared.uri
- The Namespace URI the prefix is mapped to.ContentHandler.endPrefixMapping(java.lang.String)
,
+ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+public void endPrefixMapping(java.lang.String prefix) + throws SAXException+
See startPrefixMapping
for
+ details. This event will always occur after the corresponding
+ endElement
event, but the order of
+ endPrefixMapping
events is not otherwise
+ guaranteed.
prefix
- The prefix that was being mapping.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
,
+ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
+public final void startDTD(java.lang.String name, + java.lang.String publicId, + java.lang.String systemId) + throws SAXException+
This method is intended to report the beginning of the + DOCTYPE declaration; if the document has no DOCTYPE declaration, + this method will not be invoked.
+ +All declarations reported through
+ DTDHandler
or
+ DeclHandler
events must appear
+ between the startDTD and endDTD
events.
+ Declarations are assumed to belong to the internal DTD subset
+ unless they appear between startEntity
+ and endEntity
events. Comments and
+ processing instructions from the DTD should also be reported
+ between the startDTD and endDTD events, in their original
+ order of (logical) occurrence; they are not required to
+ appear in their correct locations relative to DTDHandler
+ or DeclHandler events, however.
Note that the start/endDTD events will appear within
+ the start/endDocument events from ContentHandler and
+ before the first
+ startElement
+ event.
name
- 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.LexicalHandler.endDTD()
,
+LexicalHandler.startEntity(java.lang.String)
+public void endDTD()+
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.
LexicalHandler.startDTD(java.lang.String, java.lang.String, java.lang.String)
+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.
name
- The element type name.model
- The content model as a normalized string.+public void attributeDecl(java.lang.String eName, + java.lang.String aName, + java.lang.String type, + java.lang.String valueDefault, + 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.
+ +Any parameter entities in the attribute value will be + expanded, but general entities will not.
eName
- The name of the associated element.aName
- The name of the attribute.type
- A string representing the attribute type.valueDefault
- A string representing the attribute default
+ ("#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.+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.
name
- The name of the entity. If it is a parameter
+ entity, the name will begin with '%'.value
- The replacement text of the entity.DeclHandler.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.
name
- The name of the entity. If it is a parameter
+ entity, the name will begin with '%'.publicId
- The declared public identifier of the entity, or
+ null if none was declared.systemId
- The declared system identifier of the entity.DeclHandler.internalEntityDecl(java.lang.String, java.lang.String)
,
+DTDHandler.unparsedEntityDecl(java.lang.String, 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+
Note that the notation name corresponds to a notation
+ reported by the notationDecl
event.
+ It is up to the application to record the entity for later
+ reference, if necessary.
If the system identifier is a URL, the parser must resolve it + fully before passing it to the application.
name
- The unparsed entity's name.publicId
- The entity's public identifier, or null if none
+ was given.systemId
- The entity's system identifier.notation
- name The name of the associated notation.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
,
+AttributeList
+public void notationDecl(java.lang.String name, + java.lang.String publicId, + java.lang.String systemId) + throws SAXException+
It is up to the application to record the notation for later + reference, if necessary.
+ +At least one of publicId and systemId must be non-null. + If a system identifier is present, and it is a URL, the SAX + parser must resolve it fully before passing it to the + application through this event.
+ +There is no guarantee that the notation declaration will be + reported before any unparsed entities that use it.
name
- The notation name.publicId
- The notation's public identifier, or null if
+ none was given.systemId
- The notation's system identifier, or null if
+ none was given.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
,
+AttributeList
+protected void serializeNode(Node node) + throws java.io.IOException+
serializeElement(org.w3c.dom.Element)
.node
- The node to serializeserializeElement(org.w3c.dom.Element)
+protected ElementState content() + throws java.io.IOException+
+protected void characters(java.lang.String text) + throws java.io.IOException+
text
- The text to printunescaped
- True is should print unescaped+protected abstract java.lang.String getEntityRef(int ch)+
ch
- Character value+protected abstract void serializeElement(Element elem) + throws java.io.IOException+
elem
- The element to serialize+protected void serializePreRoot() + throws java.io.IOException+
+protected final void printText(char[] chars, + int start, + int length, + boolean preserveSpace, + boolean unescaped) + throws java.io.IOException+
#printText(String)
with a call to #breakLine
+ for each new line. If spaces are not preserved, the text is
+ broken at space boundaries if longer than the line width;
+ Multiple spaces are printed as such, but spaces at beginning
+ of line are removed.text
- The text to printpreserveSpace
- Space preserving flagunescaped
- Print unescaped+protected final void printText(java.lang.String text, + boolean preserveSpace, + boolean unescaped) + throws java.io.IOException+
+protected void printDoctypeURL(java.lang.String url) + throws java.io.IOException+
printText(char[], int, int, boolean, boolean)
.url
- The document type url to print+protected void printEscaped(int ch) + throws java.io.IOException+
+protected void printEscaped(java.lang.String source) + throws java.io.IOException+
source
- The string to escape+protected ElementState getElementState()+
+protected ElementState enterElementState(java.lang.String namespaceURI, + java.lang.String localName, + java.lang.String rawName, + boolean preserveSpace)+
+protected ElementState leaveElementState()+
+protected boolean isDocumentState()+
+protected java.lang.String getPrefix(java.lang.String namespaceURI)+
namespaceURI
- The namespace URI
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+Interface for a DOM serializer implementation. +
+
+Method Summary | +|
+ void |
+serialize(Document doc)
+
++ Serializes the DOM document. |
+
+ void |
+serialize(DocumentFragment frag)
+
++ Serializes the DOM document fragment. |
+
+ void |
+serialize(Element elem)
+
++ Serialized the DOM element. |
+
+Method Detail | +
+public void serialize(Element elem) + throws java.io.IOException+
elem
- The element to serialize+public void serialize(Document doc) + throws java.io.IOException+
doc
- The document to serialize+public void serialize(DocumentFragment frag) + throws java.io.IOException+
frag
- The document fragment to serialize
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.ElementState ++
+Holds the state of the currently serialized element. +
+
BaseMarkupSerializer
+Constructor Summary | +|
ElementState()
+
++ |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Constructor Detail | +
+public ElementState()+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.EncodingInfo ++
+This class represents an encoding. +
+
+Constructor Summary | +|
EncodingInfo(java.lang.String mimeName,
+ int lastPrintable)
+
++ Creates new EncodingInfo instance. |
+|
EncodingInfo(java.lang.String mimeName,
+ java.lang.String javaName,
+ int lastPrintable)
+
++ Creates new EncodingInfo instance. |
+
+Method Summary | +|
+ java.lang.String |
+getName()
+
++ Returns a MIME charset name of this encoding. |
+
+ java.io.Writer |
+getWriter(java.io.OutputStream output)
+
++ Returns a writer for this encoding based on + an output stream. |
+
+ boolean |
+isPrintable(int ch)
+
++ Checks whether the specified character is printable or not. |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Constructor Detail | +
+public EncodingInfo(java.lang.String mimeName, + java.lang.String javaName, + int lastPrintable)+
EncodingInfo
instance.+public EncodingInfo(java.lang.String mimeName, + int lastPrintable)+
EncodingInfo
instance.+Method Detail | +
+public java.lang.String getName()+
+public java.io.Writer getWriter(java.io.OutputStream output) + throws java.io.UnsupportedEncodingException+
+public boolean isPrintable(int ch)+
ch
- a code point (0-0x10ffff)
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.Encodings ++
+Provides information about encodings. Depends on the Java runtime + to provides writers for the different encodings, but can be used + to override encoding names and provide the last printable character + for each encoding. +
+
+Constructor Summary | +|
Encodings()
+
++ |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Constructor Detail | +
+public Encodings()+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.BaseMarkupSerializer + | + +--org.apache.xml.serialize.HTMLSerializer ++
+Implements an HTML/XHTML serializer supporting both DOM and SAX
+ pretty serializing. HTML/XHTML mode is determined in the
+ constructor. For usage instructions see Serializer
.
+
+ If an output stream is used, the encoding is taken from the + output format (defaults to UTF-8). If a writer is + used, make sure the writer uses the same encoding (if applies) + as specified in the output format. +
+ The serializer supports both DOM and SAX. DOM serializing is done
+ by calling BaseMarkupSerializer.serialize(org.w3c.dom.Element)
and SAX serializing is done by firing
+ SAX events and using the serializer as a document handler.
+
+ If an I/O exception occurs while serializing, the serializer
+ will not throw an exception directly, but only throw it
+ at the end of serializing (either DOM or SAX's DocumentHandler.endDocument()
.
+
+ For elements that are not specified as whitespace preserving, + the serializer will potentially break long text lines at space + boundaries, indent lines, and serialize elements on separate + lines. Line terminators will be regarded as spaces, and + spaces at beginning of line will be stripped. +
+ XHTML is slightly different than HTML: +
+
Serializer
+Field Summary | +|
+static java.lang.String |
+XHTMLNamespace
+
++ |
+
Fields inherited from class org.apache.xml.serialize.BaseMarkupSerializer | +
_docTypePublicId,
+_docTypeSystemId,
+_format,
+_indenting,
+_prefixes,
+_printer,
+_started |
+
+Constructor Summary | +|
+ |
+HTMLSerializer()
+
++ Constructs a new serializer. |
+
+protected |
+HTMLSerializer(boolean xhtml,
+ OutputFormat format)
+
++ Constructs a new HTML/XHTML serializer depending on the value of + xhtml. |
+
+ |
+HTMLSerializer(OutputFormat format)
+
++ Constructs a new serializer. |
+
+ |
+HTMLSerializer(java.io.OutputStream output,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified output + stream using the specified output format. |
+
+ |
+HTMLSerializer(java.io.Writer writer,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified writer + using the specified output format. |
+
+Method Summary | +|
+ void |
+characters(char[] chars,
+ int start,
+ int length)
+
++ Receive notification of character data. |
+
+protected void |
+characters(java.lang.String text)
+
++ Called to print the text contents in the prevailing element format. |
+
+ void |
+endElement(java.lang.String tagName)
+
++ Receive notification of the end of an element. |
+
+ void |
+endElement(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName)
+
++ Receive notification of the end of an element. |
+
+ void |
+endElementIO(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName)
+
++ |
+
+protected java.lang.String |
+escapeURI(java.lang.String uri)
+
++ |
+
+protected java.lang.String |
+getEntityRef(int ch)
+
++ Returns the suitable entity reference for this character value, + or null if no such entity exists. |
+
+protected void |
+serializeElement(Element elem)
+
++ Called to serialize a DOM element. |
+
+ void |
+setOutputFormat(OutputFormat format)
+
++ Specifies an output format for this serializer. |
+
+protected void |
+startDocument(java.lang.String rootTagName)
+
++ Called to serialize the document's DOCTYPE by the root element. |
+
+ void |
+startElement(java.lang.String tagName,
+ AttributeList attrs)
+
++ Receive notification of the beginning of an element. |
+
+ void |
+startElement(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName,
+ Attributes attrs)
+
++ Receive notification of the beginning of an element. |
+
Methods inherited from class org.apache.xml.serialize.BaseMarkupSerializer | +
asContentHandler,
+asDocumentHandler,
+asDOMSerializer,
+attributeDecl,
+comment,
+comment,
+content,
+elementDecl,
+endCDATA,
+endDocument,
+endDTD,
+endEntity,
+endNonEscaping,
+endPrefixMapping,
+endPreserving,
+enterElementState,
+externalEntityDecl,
+getElementState,
+getPrefix,
+ignorableWhitespace,
+internalEntityDecl,
+isDocumentState,
+leaveElementState,
+notationDecl,
+prepare,
+printDoctypeURL,
+printEscaped,
+printEscaped,
+printText,
+printText,
+processingInstruction,
+processingInstructionIO,
+reset,
+serialize,
+serialize,
+serialize,
+serializeNode,
+serializePreRoot,
+setDocumentLocator,
+setOutputByteStream,
+setOutputCharStream,
+skippedEntity,
+startCDATA,
+startDocument,
+startDTD,
+startEntity,
+startNonEscaping,
+startPrefixMapping,
+startPreserving,
+unparsedEntityDecl |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Field Detail | +
+public static java.lang.String XHTMLNamespace+
+Constructor Detail | +
+protected HTMLSerializer(boolean xhtml, + OutputFormat format)+
#init
first.xhtml
- True if XHTML serializing+public HTMLSerializer()+
BaseMarkupSerializer.setOutputCharStream(java.io.Writer)
or BaseMarkupSerializer.setOutputByteStream(java.io.OutputStream)
+ first.+public HTMLSerializer(OutputFormat format)+
BaseMarkupSerializer.setOutputCharStream(java.io.Writer)
or BaseMarkupSerializer.setOutputByteStream(java.io.OutputStream)
+ first.+public HTMLSerializer(java.io.Writer writer, + OutputFormat format)+
writer
- The writer to useformat
- The output format to use, null for the default+public HTMLSerializer(java.io.OutputStream output, + OutputFormat format)+
output
- The output stream to useformat
- The output format to use, null for the default+Method Detail | +
+public void setOutputFormat(OutputFormat format)+
format
- The output format to use+public void startElement(java.lang.String namespaceURI, + java.lang.String localName, + java.lang.String rawName, + Attributes attrs) + throws SAXException+
The Parser will invoke this method at the beginning of every
+ element in the XML document; there will be a corresponding
+ endElement
event for every startElement event
+ (even when the element is empty). All of the element's content will be
+ reported, in order, before the corresponding endElement
+ event.
This event allows up to three name components for each + element:
+ +Any or all of these may be provided, depending on the + values of the http://xml.org/sax/features/namespaces + and the http://xml.org/sax/features/namespace-prefixes + properties:
+ +Note that the attribute list provided will contain only
+ attributes with explicit values (specified or defaulted):
+ #IMPLIED attributes will be omitted. The attribute list
+ will contain attributes used for Namespace declarations
+ (xmlns* attributes) only if the
+ http://xml.org/sax/features/namespace-prefixes
+ property is true (it is false by default, and support for a
+ true value is optional).
uri
- 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.ContentHandler.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 rawName) + throws SAXException+
The SAX parser will invoke this method at the end of every
+ element in the XML document; there will be a corresponding
+ startElement
event for every endElement
+ event (even when the element is empty).
For information on the names, see startElement.
uri
- 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.+public void endElementIO(java.lang.String namespaceURI, + java.lang.String localName, + java.lang.String rawName) + throws java.io.IOException+
+public void characters(char[] chars, + int start, + int length) + throws SAXException+
The Parser will call this method to report each chunk of + character data. SAX parsers may return all contiguous character + data in a single chunk, or they may split it into several + chunks; however, all of the characters in any single event + must come from the same external entity so that the Locator + provides useful information.
+ +The application must not attempt to read from the array + outside of the specified range.
+ +Note that some parsers will report whitespace in element
+ content using the ignorableWhitespace
+ method rather than this one (validating parsers must
+ do so).
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.ContentHandler.ignorableWhitespace(char[], int, int)
,
+Locator
+public void startElement(java.lang.String tagName, + AttributeList attrs) + throws SAXException+
The Parser will invoke this method at the beginning of every + element in the XML document; there will be a corresponding + endElement() event for every startElement() event (even when the + element is empty). All of the element's content will be + reported, in order, before the corresponding endElement() + event.
+ +If the element name has a namespace prefix, the prefix will + still be attached. Note that the attribute list provided will + contain only attributes with explicit values (specified or + defaulted): #IMPLIED attributes will be omitted.
name
- The element type name.atts
- The attributes attached to the element, if any.DocumentHandler.endElement(java.lang.String)
,
+AttributeList
+public void endElement(java.lang.String tagName) + throws SAXException+
The SAX parser will invoke this method at the end of every + element in the XML document; there will be a corresponding + startElement() event for every endElement() event (even when the + element is empty).
+ +If the element name has a namespace prefix, the prefix will + still be attached to the name.
name
- The element type name+protected void startDocument(java.lang.String rootTagName) + throws java.io.IOException+
+ This method will check if it has not been called before (BaseMarkupSerializer._started
),
+ will serialize the document type declaration, and will serialize all
+ pre-root comments and PIs that were accumulated in the document
+ (see BaseMarkupSerializer.serializePreRoot()
). Pre-root will be serialized even if
+ this is not the first root element of the document.
+protected void serializeElement(Element elem) + throws java.io.IOException+
startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
, endElement(java.lang.String, java.lang.String, java.lang.String)
and serializing everything
+ inbetween, but better optimized.elem
- The element to serialize+protected void characters(java.lang.String text) + throws java.io.IOException+
text
- The text to printunescaped
- True is should print unescaped+protected java.lang.String getEntityRef(int ch)+
ch
- Character value+protected java.lang.String escapeURI(java.lang.String uri)+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.HTMLdtd ++
+Utility class for accessing information specific to HTML documents.
+ The HTML DTD is expressed as three utility function groups. Two methods
+ allow for checking whether an element requires an open tag on printing
+ (isEmptyTag(java.lang.String)
) or on parsing (isOptionalClosing(java.lang.String)
).
+
+ Two other methods translate character references from name to value and + from value to name. A small entities resource is loaded into memory the + first time any of these methods is called for fast and efficient access. +
+
+Field Summary | +|
+static java.lang.String |
+HTMLPublicId
+
++ Public identifier for HTML document type. |
+
+static java.lang.String |
+HTMLSystemId
+
++ System identifier for HTML document type. |
+
+static java.lang.String |
+XHTMLPublicId
+
++ Public identifier for XHTML document type. |
+
+static java.lang.String |
+XHTMLSystemId
+
++ System identifier for XHTML document type. |
+
+Constructor Summary | +|
HTMLdtd()
+
++ |
+
+Method Summary | +|
+static int |
+charFromName(java.lang.String name)
+
++ Returns the value of an HTML character reference by its name. |
+
+static java.lang.String |
+fromChar(int value)
+
++ Returns the name of an HTML character reference based on its character + value. |
+
+static boolean |
+isBoolean(java.lang.String tagName,
+ java.lang.String attrName)
+
++ Returns true if the specified attribute is a boolean and should be + printed without the value. |
+
+static boolean |
+isClosing(java.lang.String tagName,
+ java.lang.String openTag)
+
++ Returns true if the opening of one element (tagName) implies + the closing of another open element (openTag). |
+
+static boolean |
+isElementContent(java.lang.String tagName)
+
++ Returns true if element is declared to have element content. |
+
+static boolean |
+isEmptyTag(java.lang.String tagName)
+
++ Returns true if element is declared to be empty. |
+
+static boolean |
+isOnlyOpening(java.lang.String tagName)
+
++ Returns true if element's closing tag is generally not printed. |
+
+static boolean |
+isOptionalClosing(java.lang.String tagName)
+
++ Returns true if element's closing tag is optional and need not + exist. |
+
+static boolean |
+isPreserveSpace(java.lang.String tagName)
+
++ Returns true if element's textual contents preserves spaces. |
+
+static boolean |
+isURI(java.lang.String tagName,
+ java.lang.String attrName)
+
++ Returns true if the specified attribute it a URI and should be + escaped appropriately. |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Field Detail | +
+public static final java.lang.String HTMLPublicId+
+public static final java.lang.String HTMLSystemId+
+public static final java.lang.String XHTMLPublicId+
+public static final java.lang.String XHTMLSystemId+
+Constructor Detail | +
+public HTMLdtd()+
+Method Detail | +
+public static boolean isEmptyTag(java.lang.String tagName)+
tagName
- The element tag name (upper case)+public static boolean isElementContent(java.lang.String tagName)+
tagName
- The element tag name (upper case)+public static boolean isPreserveSpace(java.lang.String tagName)+
tagName
- The element tag name (upper case)+public static boolean isOptionalClosing(java.lang.String tagName)+
tagName
- The element tag name (upper case)+public static boolean isOnlyOpening(java.lang.String tagName)+
tagName
- The element tag name (upper case)+public static boolean isClosing(java.lang.String tagName, + java.lang.String openTag)+
tagName
- The newly opened elementopenTag
- The already opened element+public static boolean isURI(java.lang.String tagName, + java.lang.String attrName)+
tagName
- The element's tag nameattrName
- The attribute's name+public static boolean isBoolean(java.lang.String tagName, + java.lang.String attrName)+
tagName
- The element's tag nameattrName
- The attribute's name+public static int charFromName(java.lang.String name)+
name
- Name of character reference+public static java.lang.String fromChar(int value)+
value
- Character value of entity
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.Printer + | + +--org.apache.xml.serialize.IndentPrinter ++
+Extends Printer
and adds support for indentation and line
+ wrapping.
+
+
Fields inherited from class org.apache.xml.serialize.Printer | +
_docWriter,
+_dtdWriter,
+_exception,
+_format,
+_writer |
+
+Method Summary | +|
+ void |
+breakLine()
+
++ Called to print a line consisting of the text accumulated so + far. |
+
+ void |
+breakLine(boolean preserveSpace)
+
++ |
+
+ void |
+enterDTD()
+
++ Called by any of the DTD handlers to enter DTD mode. |
+
+ void |
+flush()
+
++ Flush the output stream. |
+
+ void |
+flushLine(boolean preserveSpace)
+
++ Flushes the line accumulated so far to the writer and get ready + to accumulate the next line. |
+
+ int |
+getNextIndent()
+
++ |
+
+ void |
+indent()
+
++ Increment the indentation for the next line. |
+
+ java.lang.String |
+leaveDTD()
+
++ Called by the root element to leave DTD mode and if any + DTD parts were printer, will return a string with their + textual content. |
+
+ void |
+printSpace()
+
++ Called to print a single space between text parts that may be + broken into separate lines. |
+
+ void |
+printText(char ch)
+
++ |
+
+ void |
+printText(char[] chars,
+ int start,
+ int length)
+
++ |
+
+ void |
+printText(java.lang.String text)
+
++ Called to print additional text. |
+
+ void |
+printText(java.lang.StringBuffer text)
+
++ |
+
+ void |
+setNextIndent(int indent)
+
++ |
+
+ void |
+setThisIndent(int indent)
+
++ |
+
+ void |
+unindent()
+
++ Decrement the indentation for the next line. |
+
Methods inherited from class org.apache.xml.serialize.Printer | +
getException |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Method Detail | +
+public void enterDTD()+
leaveDTD()
.+public java.lang.String leaveDTD()+
+public void printText(java.lang.String text)+
printSpace()
) all the accumulated text becomes one part and is
+ added to the accumulate line. When a line is long enough, it can
+ be broken at its text boundary.text
- The text to print+public void printText(java.lang.StringBuffer text)+
+public void printText(char ch)+
+public void printText(char[] chars, + int start, + int length)+
+public void printSpace()+
printText(java.lang.String)
will be added to the accumulated line, and a space
+ separator will be counted. If the line accumulated so far is
+ long enough, it will be printed.+public void breakLine()+
printSpace()
but
+ forcing the line to print and starting a new line (printSpace()
will only start a new line if the current line
+ is long enough).+public void breakLine(boolean preserveSpace)+
+public void flushLine(boolean preserveSpace)+
printText(java.lang.String)
and printSpace()
when the accumulated line plus
+ accumulated text are two long to fit on a given line. At the end of
+ this method #_line
is empty and #_spaces
is zero.+public void flush()+
+public void indent()+
+public void unindent()+
+public int getNextIndent()+
+public void setNextIndent(int indent)+
+public void setThisIndent(int indent)+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.LineSeparator ++
+
OutputFormat
+Field Summary | +|
+static java.lang.String |
+Macintosh
+
++ Line separator for Macintosh systems (\r). |
+
+static java.lang.String |
+Unix
+
++ Line separator for Unix systems (\n). |
+
+static java.lang.String |
+Web
+
++ Line separator for the Web (\n). |
+
+static java.lang.String |
+Windows
+
++ Line separator for Windows systems (\r\n). |
+
+Constructor Summary | +|
LineSeparator()
+
++ |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Field Detail | +
+public static final java.lang.String Unix+
+public static final java.lang.String Windows+
+public static final java.lang.String Macintosh+
+public static final java.lang.String Web+
+Constructor Detail | +
+public LineSeparator()+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.Method ++
+
OutputFormat
+Field Summary | +|
+static java.lang.String |
+FOP
+
++ The output method for FO documents as PDF. |
+
+static java.lang.String |
+HTML
+
++ The output method for HTML documents. |
+
+static java.lang.String |
+TEXT
+
++ The output method for text documents. |
+
+static java.lang.String |
+XHTML
+
++ The output method for HTML documents as XHTML. |
+
+static java.lang.String |
+XML
+
++ The output method for XML documents. |
+
+Constructor Summary | +|
Method()
+
++ |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Field Detail | +
+public static final java.lang.String XML+
+public static final java.lang.String HTML+
+public static final java.lang.String XHTML+
+public static final java.lang.String TEXT+
+public static final java.lang.String FOP+
+Constructor Detail | +
+public Method()+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.OutputFormat.DTD ++
+
+Field Summary | +|
+static java.lang.String |
+HTMLPublicId
+
++ Public identifier for HTML document type. |
+
+static java.lang.String |
+HTMLSystemId
+
++ System identifier for HTML document type. |
+
+static java.lang.String |
+XHTMLPublicId
+
++ Public identifier for XHTML document type. |
+
+static java.lang.String |
+XHTMLSystemId
+
++ System identifier for XHTML document type. |
+
+Constructor Summary | +|
OutputFormat.DTD()
+
++ |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Field Detail | +
+public static final java.lang.String HTMLPublicId+
+public static final java.lang.String HTMLSystemId+
+public static final java.lang.String XHTMLPublicId+
+public static final java.lang.String XHTMLSystemId+
+Constructor Detail | +
+public OutputFormat.DTD()+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.OutputFormat.Defaults ++
+
+Field Summary | +|
+static java.lang.String |
+Encoding
+
++ The default encoding for Web documents it UTF-8. |
+
+static int |
+Indent
+
++ If indentation is turned on, the default identation + level is 4. |
+
+static int |
+LineWidth
+
++ The default line width at which to break long lines + when identing. |
+
+Constructor Summary | +|
OutputFormat.Defaults()
+
++ |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Field Detail | +
+public static final int Indent+
OutputFormat.setIndenting(boolean)
+public static final java.lang.String Encoding+
OutputFormat.getEncoding()
+public static final int LineWidth+
+Constructor Detail | +
+public OutputFormat.Defaults()+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.OutputFormat ++
+Specifies an output format to control the serializer. Based on the + XSLT specification for output format, plus additional parameters. + Used to select the suitable serializer and determine how the + document should be formatted on output. +
+ The two interesting constructors are: +
OutputFormat(String,String,boolean)
creates a format
+ for the specified method (XML, HTML, Text, etc), encoding and indentation
+ OutputFormat(Document,String,boolean)
creates a format
+ compatible with the document type (XML, HTML, Text, etc), encoding and
+ indentation
+ +
Serializer
,
+Method
,
+LineSeparator
+Inner Class Summary | +|
+static class |
+OutputFormat.Defaults
+
++ |
+
+static class |
+OutputFormat.DTD
+
++ |
+
+Constructor Summary | +|
OutputFormat()
+
++ Constructs a new output format with the default values. |
+|
OutputFormat(Document doc)
+
++ Constructs a new output format with the proper method, + document type identifiers and media type for the specified + document. |
+|
OutputFormat(Document doc,
+ java.lang.String encoding,
+ boolean indenting)
+
++ Constructs a new output format with the proper method, + document type identifiers and media type for the specified + document, and with the specified encoding. |
+|
OutputFormat(java.lang.String method,
+ java.lang.String encoding,
+ boolean indenting)
+
++ Constructs a new output format with the default values for + the specified method and encoding. |
+
+Method Summary | +|
+ java.lang.String[] |
+getCDataElements()
+
++ Returns a list of all the elements whose text node children + should be output as CDATA, or null if no such elements were + specified. |
+
+ java.lang.String |
+getDoctypePublic()
+
++ Returns the specified document type public identifier, + or null. |
+
+ java.lang.String |
+getDoctypeSystem()
+
++ Returns the specified document type system identifier, + or null. |
+
+ java.lang.String |
+getEncoding()
+
++ Returns the specified encoding. |
+
+ EncodingInfo |
+getEncodingInfo()
+
++ Returns an EncodingInfo |
+
+ int |
+getIndent()
+
++ Returns the indentation specified. |
+
+ boolean |
+getIndenting()
+
++ Returns true if indentation was specified. |
+
+ char |
+getLastPrintable()
+
++ Returns the last printable character based on the selected + encoding. |
+
+ java.lang.String |
+getLineSeparator()
+
++ Returns a specific line separator to use. |
+
+ int |
+getLineWidth()
+
++ Return the selected line width for breaking up long lines. |
+
+ java.lang.String |
+getMediaType()
+
++ Returns the specified media type, or null. |
+
+ java.lang.String |
+getMethod()
+
++ Returns the method specified for this output format. |
+
+ java.lang.String[] |
+getNonEscapingElements()
+
++ Returns a list of all the elements whose text node children + should be output unescaped (no character references), or null + if no such elements were specified. |
+
+ boolean |
+getOmitComments()
+
++ Returns true if comments should be ommited. |
+
+ boolean |
+getOmitDocumentType()
+
++ Returns true if the DOCTYPE declaration should + be ommited. |
+
+ boolean |
+getOmitXMLDeclaration()
+
++ Returns true if the XML document declaration should + be ommited. |
+
+ boolean |
+getPreserveEmptyAttributes()
+
++ Returns the preserveEmptyAttribute flag. |
+
+ boolean |
+getPreserveSpace()
+
++ Returns true if the default behavior for this format is to + preserve spaces. |
+
+ boolean |
+getStandalone()
+
++ Returns true if the document type is standalone. |
+
+ java.lang.String |
+getVersion()
+
++ Returns the version for this output method. |
+
+ boolean |
+isCDataElement(java.lang.String tagName)
+
++ Returns true if the text node children of the given elements + should be output as CDATA. |
+
+ boolean |
+isNonEscapingElement(java.lang.String tagName)
+
++ Returns true if the text node children of the given elements + should be output unescaped. |
+
+ void |
+setCDataElements(java.lang.String[] cdataElements)
+
++ Sets the list of elements for which text node children + should be output as CDATA. |
+
+ void |
+setDoctype(java.lang.String publicId,
+ java.lang.String systemId)
+
++ Sets the document type public and system identifiers. |
+
+ void |
+setEncoding(EncodingInfo encInfo)
+
++ Sets the encoding for this output method with an EncodingInfo
+ instance. |
+
+ void |
+setEncoding(java.lang.String encoding)
+
++ Sets the encoding for this output method. |
+
+ void |
+setIndent(int indent)
+
++ Sets the indentation. |
+
+ void |
+setIndenting(boolean on)
+
++ Sets the indentation on and off. |
+
+ void |
+setLineSeparator(java.lang.String lineSeparator)
+
++ Sets the line separator. |
+
+ void |
+setLineWidth(int lineWidth)
+
++ Sets the line width. |
+
+ void |
+setMediaType(java.lang.String mediaType)
+
++ Sets the media type. |
+
+ void |
+setMethod(java.lang.String method)
+
++ Sets the method for this output format. |
+
+ void |
+setNonEscapingElements(java.lang.String[] nonEscapingElements)
+
++ Sets the list of elements for which text node children + should be output unescaped (no character references). |
+
+ void |
+setOmitComments(boolean omit)
+
++ Sets comment omitting on and off. |
+
+ void |
+setOmitDocumentType(boolean omit)
+
++ Sets DOCTYPE declaration omitting on and off. |
+
+ void |
+setOmitXMLDeclaration(boolean omit)
+
++ Sets XML declaration omitting on and off. |
+
+ void |
+setPreserveEmptyAttributes(boolean preserve)
+
++ Sets the preserveEmptyAttribute flag. |
+
+ void |
+setPreserveSpace(boolean preserve)
+
++ Sets space preserving as the default behavior. |
+
+ void |
+setStandalone(boolean standalone)
+
++ Sets document DTD standalone. |
+
+ void |
+setVersion(java.lang.String version)
+
++ Sets the version for this output method. |
+
+static java.lang.String |
+whichDoctypePublic(Document doc)
+
++ Returns the document type public identifier + specified for this document, or null. |
+
+static java.lang.String |
+whichDoctypeSystem(Document doc)
+
++ Returns the document type system identifier + specified for this document, or null. |
+
+static java.lang.String |
+whichMediaType(java.lang.String method)
+
++ Returns the suitable media format for a document + output with the specified method. |
+
+static java.lang.String |
+whichMethod(Document doc)
+
++ Determine the output method for the specified document. |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Constructor Detail | +
+public OutputFormat()+
+public OutputFormat(java.lang.String method, + java.lang.String encoding, + boolean indenting)+
method
- The specified output methodencoding
- The specified encodingindenting
- True for pretty printingsetEncoding(java.lang.String)
,
+setIndenting(boolean)
,
+setMethod(java.lang.String)
+public OutputFormat(Document doc)+
doc
- The document to outputwhichMethod(org.w3c.dom.Document)
+public OutputFormat(Document doc, + java.lang.String encoding, + boolean indenting)+
doc
- The document to outputencoding
- The specified encodingindenting
- True for pretty printingsetEncoding(java.lang.String)
,
+setIndenting(boolean)
,
+whichMethod(org.w3c.dom.Document)
+Method Detail | +
+public java.lang.String getMethod()+
whichMethod(org.w3c.dom.Document)
.+public void setMethod(java.lang.String method)+
method
- The output method, or nullgetMethod()
+public java.lang.String getVersion()+
+public void setVersion(java.lang.String version)+
version
- The output method version, or nullgetVersion()
+public int getIndent()+
setIndenting(boolean)
+public boolean getIndenting()+
+public void setIndent(int indent)+
setIndenting(boolean)
will reset this
+ value to zero (off) or the default (on).indent
- The indentation, or zero+public void setIndenting(boolean on)+
#DEFAULT_INDENT
and #DEFAULT_LINE_WIDTH
).
+ To specify a different indentation level or line wrapping,
+ use setIndent(int)
and setLineWidth(int)
.on
- True if indentation should be on+public java.lang.String getEncoding()+
+public void setEncoding(java.lang.String encoding)+
Writer
.encoding
- The encoding, or nullgetEncoding()
+public void setEncoding(EncodingInfo encInfo)+
EncodingInfo
+ instance.+public EncodingInfo getEncodingInfo()+
EncodingInfo instance for the encoding.
+- See Also:
setEncoding
+
+
+public java.lang.String getMediaType()+
whichMediaType(java.lang.String)
.+public void setMediaType(java.lang.String mediaType)+
mediaType
- The specified media typegetMediaType()
+public void setDoctype(java.lang.String publicId, + java.lang.String systemId)+
publicId
- The public identifier, or nullsystemId
- The system identifier, or null+public java.lang.String getDoctypePublic()+
+public java.lang.String getDoctypeSystem()+
+public boolean getOmitComments()+
+public void setOmitComments(boolean omit)+
omit
- True if comments should be ommited+public boolean getOmitDocumentType()+
+public void setOmitDocumentType(boolean omit)+
omit
- True if DOCTYPE declaration should be ommited+public boolean getOmitXMLDeclaration()+
+public void setOmitXMLDeclaration(boolean omit)+
omit
- True if XML declaration should be ommited+public boolean getStandalone()+
+public void setStandalone(boolean standalone)+
standalone
- True if document DTD is standalone+public java.lang.String[] getCDataElements()+
+public boolean isCDataElement(java.lang.String tagName)+
tagName
- The element's tag name+public void setCDataElements(java.lang.String[] cdataElements)+
cdataElements
- List of CDATA element tag names+public java.lang.String[] getNonEscapingElements()+
+public boolean isNonEscapingElement(java.lang.String tagName)+
tagName
- The element's tag name+public void setNonEscapingElements(java.lang.String[] nonEscapingElements)+
nonEscapingElements
- List of unescaped element tag names+public java.lang.String getLineSeparator()+
+public void setLineSeparator(java.lang.String lineSeparator)+
lineSeparator
- The specified line separator+public boolean getPreserveSpace()+
+public void setPreserveSpace(boolean preserve)+
preserve
- True if spaces should be preserved+public int getLineWidth()+
+public void setLineWidth(int lineWidth)+
setIndenting(boolean)
will reset this
+ value to zero (off) or the default (on).lineWidth
- The line width to use, zero for defaultgetLineWidth()
,
+setIndenting(boolean)
+public boolean getPreserveEmptyAttributes()+
+public void setPreserveEmptyAttributes(boolean preserve)+
preserve
- the preserve flag+public char getLastPrintable()+
+public static java.lang.String whichMethod(Document doc)+
HTMLDocument
+ then the method is said to be html. If the root
+ element is 'html' and all text nodes preceding the root
+ element are all whitespace, then the method is said to be
+ html. Otherwise the method is xml.doc
- The document to check+public static java.lang.String whichDoctypePublic(Document doc)+
+public static java.lang.String whichDoctypeSystem(Document doc)+
+public static java.lang.String whichMediaType(java.lang.String method)+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.Printer ++
+The printer is responsible for sending text to the output stream
+ or writer. This class performs direct writing for efficiency.
+ IndentPrinter
supports indentation and line wrapping by
+ extending this class.
+
+
+Field Summary | +|
+protected java.io.Writer |
+_docWriter
+
++ Holds a reference to the document writer while we are + in DTD mode. |
+
+protected java.io.StringWriter |
+_dtdWriter
+
++ The DTD writer. |
+
+protected java.io.IOException |
+_exception
+
++ Holds the exception thrown by the serializer. |
+
+protected OutputFormat |
+_format
+
++ The output format associated with this serializer. |
+
+protected java.io.Writer |
+_writer
+
++ The writer to which the document is written. |
+
+Constructor Summary | +|
Printer(java.io.Writer writer,
+ OutputFormat format)
+
++ |
+
+Method Summary | +|
+ void |
+breakLine()
+
++ |
+
+ void |
+breakLine(boolean preserveSpace)
+
++ |
+
+ void |
+enterDTD()
+
++ Called by any of the DTD handlers to enter DTD mode. |
+
+ void |
+flush()
+
++ Flush the output stream. |
+
+ void |
+flushLine(boolean preserveSpace)
+
++ |
+
+ java.io.IOException |
+getException()
+
++ |
+
+ int |
+getNextIndent()
+
++ |
+
+ void |
+indent()
+
++ |
+
+ java.lang.String |
+leaveDTD()
+
++ Called by the root element to leave DTD mode and if any + DTD parts were printer, will return a string with their + textual content. |
+
+ void |
+printSpace()
+
++ |
+
+ void |
+printText(char ch)
+
++ |
+
+ void |
+printText(char[] chars,
+ int start,
+ int length)
+
++ |
+
+ void |
+printText(java.lang.String text)
+
++ |
+
+ void |
+printText(java.lang.StringBuffer text)
+
++ |
+
+ void |
+setNextIndent(int indent)
+
++ |
+
+ void |
+setThisIndent(int indent)
+
++ |
+
+ void |
+unindent()
+
++ |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Field Detail | +
+protected final OutputFormat _format+
+protected java.io.Writer _writer+
+protected java.io.StringWriter _dtdWriter+
+protected java.io.Writer _docWriter+
+protected java.io.IOException _exception+
+Constructor Detail | +
+public Printer(java.io.Writer writer, + OutputFormat format)+
+Method Detail | +
+public java.io.IOException getException()+
+public void enterDTD() + throws java.io.IOException+
leaveDTD()
.+public java.lang.String leaveDTD() + throws java.io.IOException+
+public void printText(java.lang.String text) + throws java.io.IOException+
+public void printText(java.lang.StringBuffer text) + throws java.io.IOException+
+public void printText(char[] chars, + int start, + int length) + throws java.io.IOException+
+public void printText(char ch) + throws java.io.IOException+
+public void printSpace() + throws java.io.IOException+
+public void breakLine() + throws java.io.IOException+
+public void breakLine(boolean preserveSpace) + throws java.io.IOException+
+public void flushLine(boolean preserveSpace) + throws java.io.IOException+
+public void flush() + throws java.io.IOException+
+public void indent()+
+public void unindent()+
+public int getNextIndent()+
+public void setNextIndent(int indent)+
+public void setThisIndent(int indent)+
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+Interface for a DOM serializer implementation, factory for DOM and SAX + serializers, and static methods for serializing DOM documents. +
+ To serialize a document using SAX events, create a compatible serializer
+ using #makeSAXSerializer
and pass it around as a DocumentHandler
. If an I/O error occurs while serializing, it will
+ be thrown by DocumentHandler.endDocument()
. The SAX serializer
+ may also be used as DTDHandler
, DeclHandler
and
+ LexicalHandler
.
+
+ To serialize a DOM document or DOM element, create a compatible
+ serializer using #makeSerializer
and call it's #serialize(Document)
or #serialize(Element)
methods.
+ Both methods would produce a full XML document, to serizlie only
+ the portion of the document use OutputFormat.setOmitXMLDeclaration(boolean)
+ and specify no document type.
+
+ The convenience method #serialize(Document,Writer,OutputFormat)
+ creates a serializer and calls #serizlie(Document)
on that
+ serialized.
+
+ The OutputFormat
dictates what underlying serialized is used
+ to serialize the document based on the specified method. If the output
+ format or method are missing, the default is an XML serializer with
+ UTF-8 encoding and now indentation.
+
+
DocumentHandler
,
+ContentHandler
,
+OutputFormat
,
+DOMSerializer
+Method Summary | +|
+ ContentHandler |
+asContentHandler()
+
++ Return a ContentHandler interface into this serializer. |
+
+ DocumentHandler |
+asDocumentHandler()
+
++ Return a DocumentHandler interface into this serializer. |
+
+ DOMSerializer |
+asDOMSerializer()
+
++ Return a DOMSerializer interface into this serializer. |
+
+ void |
+setOutputByteStream(java.io.OutputStream output)
+
++ Specifies an output stream to which the document should be + serialized. |
+
+ void |
+setOutputCharStream(java.io.Writer output)
+
++ Specifies a writer to which the document should be serialized. |
+
+ void |
+setOutputFormat(OutputFormat format)
+
++ Specifies an output format for this serializer. |
+
+Method Detail | +
+public void setOutputByteStream(java.io.OutputStream output)+
+public void setOutputCharStream(java.io.Writer output)+
+public void setOutputFormat(OutputFormat format)+
format
- The output format to use+public DocumentHandler asDocumentHandler() + throws java.io.IOException+
DocumentHandler
interface into this serializer.
+ If the serializer does not support the DocumentHandler
+ interface, it should return null.+public ContentHandler asContentHandler() + throws java.io.IOException+
ContentHandler
interface into this serializer.
+ If the serializer does not support the ContentHandler
+ interface, it should return null.+public DOMSerializer asDOMSerializer() + throws java.io.IOException+
DOMSerializer
interface into this serializer.
+ If the serializer does not support the DOMSerializer
+ interface, it should return null.
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.SerializerFactory ++
+
+Field Summary | +|
+static java.lang.String |
+FactoriesProperty
+
++ |
+
+Constructor Summary | +|
SerializerFactory()
+
++ |
+
+Method Summary | +|
+static SerializerFactory |
+getSerializerFactory(java.lang.String method)
+
++ Register a serializer factory, keyed by the given + method string. |
+
+protected abstract java.lang.String |
+getSupportedMethod()
+
++ Returns the method supported by this factory and used to register + the factory. |
+
+abstract Serializer |
+makeSerializer(OutputFormat format)
+
++ Create a new serializer based on the OutputFormat . |
+
+abstract Serializer |
+makeSerializer(java.io.OutputStream output,
+ OutputFormat format)
+
++ Create a new serializer, based on the OutputFormat and
+ using the output byte stream and the encoding specified in the
+ output format. |
+
+abstract Serializer |
+makeSerializer(java.io.Writer writer,
+ OutputFormat format)
+
++ Create a new serializer, based on the OutputFormat and
+ using the writer as the output character stream. |
+
+static void |
+registerSerializerFactory(SerializerFactory factory)
+
++ Register a serializer factory, keyed by the given + method string. |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Field Detail | +
+public static final java.lang.String FactoriesProperty+
+Constructor Detail | +
+public SerializerFactory()+
+Method Detail | +
+public static void registerSerializerFactory(SerializerFactory factory)+
+public static SerializerFactory getSerializerFactory(java.lang.String method)+
+protected abstract java.lang.String getSupportedMethod()+
+public abstract Serializer makeSerializer(OutputFormat format)+
OutputFormat
.
+ If this method is used to create the serializer, the Serializer.setOutputByteStream(java.io.OutputStream)
or Serializer.setOutputCharStream(java.io.Writer)
+ methods must be called before serializing a document.+public abstract Serializer makeSerializer(java.io.Writer writer, + OutputFormat format)+
OutputFormat
and
+ using the writer as the output character stream. If this
+ method is used, the encoding property will be ignored.+public abstract Serializer makeSerializer(java.io.OutputStream output, + OutputFormat format) + throws java.io.UnsupportedEncodingException+
OutputFormat
and
+ using the output byte stream and the encoding specified in the
+ output format.
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.EncodingInfo + | + +--org.apache.xml.serialize.SieveEncodingInfo ++
+This class represents an encoding. +
+
+Constructor Summary | +|
SieveEncodingInfo(java.lang.String mimeName,
+ int lastPrintable)
+
++ Creates new SeiveEncodingInfo instance. |
+|
SieveEncodingInfo(java.lang.String mimeName,
+ java.lang.String javaName,
+ int lastPrintable,
+ java.lang.String dangers)
+
++ Creates new SeiveEncodingInfo instance. |
+
+Method Summary | +|
+ boolean |
+isPrintable(int ch)
+
++ Checks whether the specified character is printable or not. |
+
Methods inherited from class org.apache.xml.serialize.EncodingInfo | +
getName,
+getWriter |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Constructor Detail | +
+public SieveEncodingInfo(java.lang.String mimeName, + java.lang.String javaName, + int lastPrintable, + java.lang.String dangers)+
SeiveEncodingInfo
instance.dangers
- A sorted characters that are always printed as character references.+public SieveEncodingInfo(java.lang.String mimeName, + int lastPrintable)+
SeiveEncodingInfo
instance.+Method Detail | +
+public boolean isPrintable(int ch)+
ch
- a code point (0-0x10ffff)
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.BaseMarkupSerializer + | + +--org.apache.xml.serialize.TextSerializer ++
+Implements a text serializer supporting both DOM and SAX
+ serializing. For usage instructions see Serializer
.
+
+ If an output stream is used, the encoding is taken from the + output format (defaults to UTF-8). If a writer is + used, make sure the writer uses the same encoding (if applies) + as specified in the output format. +
+ The serializer supports both DOM and SAX. DOM serializing is done
+ by calling BaseMarkupSerializer.serialize(org.w3c.dom.Element)
and SAX serializing is done by firing
+ SAX events and using the serializer as a document handler.
+
+ If an I/O exception occurs while serializing, the serializer
+ will not throw an exception directly, but only throw it
+ at the end of serializing (either DOM or SAX's DocumentHandler.endDocument()
.
+
+
Serializer
Fields inherited from class org.apache.xml.serialize.BaseMarkupSerializer | +
_docTypePublicId,
+_docTypeSystemId,
+_format,
+_indenting,
+_prefixes,
+_printer,
+_started |
+
+Constructor Summary | +|
TextSerializer()
+
++ Constructs a new serializer. |
+
+Method Summary | +|
+ void |
+characters(char[] chars,
+ int start,
+ int length)
+
++ Receive notification of character data. |
+
+protected void |
+characters(java.lang.String text,
+ boolean unescaped)
+
++ |
+
+ void |
+comment(char[] chars,
+ int start,
+ int length)
+
++ Report an XML comment anywhere in the document. |
+
+ void |
+comment(java.lang.String text)
+
++ |
+
+protected ElementState |
+content()
+
++ Must be called by a method about to print any type of content. |
+
+ void |
+endElement(java.lang.String tagName)
+
++ Receive notification of the end of an element. |
+
+ void |
+endElement(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName)
+
++ Receive notification of the end of an element. |
+
+ void |
+endElementIO(java.lang.String tagName)
+
++ |
+
+protected java.lang.String |
+getEntityRef(int ch)
+
++ Returns the suitable entity reference for this character value, + or null if no such entity exists. |
+
+ void |
+processingInstructionIO(java.lang.String target,
+ java.lang.String code)
+
++ |
+
+protected void |
+serializeElement(Element elem)
+
++ Called to serialize a DOM element. |
+
+protected void |
+serializeNode(Node node)
+
++ Serialize the DOM node. |
+
+ void |
+setOutputFormat(OutputFormat format)
+
++ Specifies an output format for this serializer. |
+
+protected void |
+startDocument(java.lang.String rootTagName)
+
++ Called to serialize the document's DOCTYPE by the root element. |
+
+ void |
+startElement(java.lang.String tagName,
+ AttributeList attrs)
+
++ Receive notification of the beginning of an element. |
+
+ void |
+startElement(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName,
+ Attributes attrs)
+
++ Receive notification of the beginning of an element. |
+
Methods inherited from class org.apache.xml.serialize.BaseMarkupSerializer | +
asContentHandler,
+asDocumentHandler,
+asDOMSerializer,
+attributeDecl,
+characters,
+elementDecl,
+endCDATA,
+endDocument,
+endDTD,
+endEntity,
+endNonEscaping,
+endPrefixMapping,
+endPreserving,
+enterElementState,
+externalEntityDecl,
+getElementState,
+getPrefix,
+ignorableWhitespace,
+internalEntityDecl,
+isDocumentState,
+leaveElementState,
+notationDecl,
+prepare,
+printDoctypeURL,
+printEscaped,
+printEscaped,
+printText,
+printText,
+processingInstruction,
+reset,
+serialize,
+serialize,
+serialize,
+serializePreRoot,
+setDocumentLocator,
+setOutputByteStream,
+setOutputCharStream,
+skippedEntity,
+startCDATA,
+startDocument,
+startDTD,
+startEntity,
+startNonEscaping,
+startPrefixMapping,
+startPreserving,
+unparsedEntityDecl |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Constructor Detail | +
+public TextSerializer()+
BaseMarkupSerializer.setOutputCharStream(java.io.Writer)
or BaseMarkupSerializer.setOutputByteStream(java.io.OutputStream)
+ first.+Method Detail | +
+public void setOutputFormat(OutputFormat format)+
format
- The output format to use+public void startElement(java.lang.String namespaceURI, + java.lang.String localName, + java.lang.String rawName, + Attributes attrs) + throws SAXException+
The Parser will invoke this method at the beginning of every
+ element in the XML document; there will be a corresponding
+ endElement
event for every startElement event
+ (even when the element is empty). All of the element's content will be
+ reported, in order, before the corresponding endElement
+ event.
This event allows up to three name components for each + element:
+ +Any or all of these may be provided, depending on the + values of the http://xml.org/sax/features/namespaces + and the http://xml.org/sax/features/namespace-prefixes + properties:
+ +Note that the attribute list provided will contain only
+ attributes with explicit values (specified or defaulted):
+ #IMPLIED attributes will be omitted. The attribute list
+ will contain attributes used for Namespace declarations
+ (xmlns* attributes) only if the
+ http://xml.org/sax/features/namespace-prefixes
+ property is true (it is false by default, and support for a
+ true value is optional).
uri
- 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.ContentHandler.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 rawName) + throws SAXException+
The SAX parser will invoke this method at the end of every
+ element in the XML document; there will be a corresponding
+ startElement
event for every endElement
+ event (even when the element is empty).
For information on the names, see startElement.
uri
- 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.+public void startElement(java.lang.String tagName, + AttributeList attrs) + throws SAXException+
The Parser will invoke this method at the beginning of every + element in the XML document; there will be a corresponding + endElement() event for every startElement() event (even when the + element is empty). All of the element's content will be + reported, in order, before the corresponding endElement() + event.
+ +If the element name has a namespace prefix, the prefix will + still be attached. Note that the attribute list provided will + contain only attributes with explicit values (specified or + defaulted): #IMPLIED attributes will be omitted.
name
- The element type name.atts
- The attributes attached to the element, if any.DocumentHandler.endElement(java.lang.String)
,
+AttributeList
+public void endElement(java.lang.String tagName) + throws SAXException+
The SAX parser will invoke this method at the end of every + element in the XML document; there will be a corresponding + startElement() event for every endElement() event (even when the + element is empty).
+ +If the element name has a namespace prefix, the prefix will + still be attached to the name.
name
- The element type name+public void endElementIO(java.lang.String tagName) + throws java.io.IOException+
+public void processingInstructionIO(java.lang.String target, + java.lang.String code) + throws java.io.IOException+
+public void comment(java.lang.String text)+
+public void comment(char[] chars, + int start, + int length)+
This callback will be used for comments inside or outside the + document element, including comments in the external DTD + subset (if read). Comments in the DTD must be properly + nested inside start/endDTD and start/endEntity events (if + used).
ch
- 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.+public void characters(char[] chars, + int start, + int length) + throws SAXException+
The Parser will call this method to report each chunk of + character data. SAX parsers may return all contiguous character + data in a single chunk, or they may split it into several + chunks; however, all of the characters in any single event + must come from the same external entity so that the Locator + provides useful information.
+ +The application must not attempt to read from the array + outside of the specified range.
+ +Note that some parsers will report whitespace in element
+ content using the ignorableWhitespace
+ method rather than this one (validating parsers must
+ do so).
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.ContentHandler.ignorableWhitespace(char[], int, int)
,
+Locator
+protected void characters(java.lang.String text, + boolean unescaped) + throws java.io.IOException+
+protected void startDocument(java.lang.String rootTagName) + throws java.io.IOException+
+ This method will check if it has not been called before (BaseMarkupSerializer._started
),
+ will serialize the document type declaration, and will serialize all
+ pre-root comments and PIs that were accumulated in the document
+ (see BaseMarkupSerializer.serializePreRoot()
). Pre-root will be serialized even if
+ this is not the first root element of the document.
+protected void serializeElement(Element elem) + throws java.io.IOException+
startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
, endElement(java.lang.String, java.lang.String, java.lang.String)
and serializing everything
+ inbetween, but better optimized.elem
- The element to serialize+protected void serializeNode(Node node) + throws java.io.IOException+
node
- The node to serialize+protected ElementState content()+
+protected java.lang.String getEntityRef(int ch)+
ch
- Character value
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.BaseMarkupSerializer + | + +--org.apache.xml.serialize.HTMLSerializer + | + +--org.apache.xml.serialize.XHTMLSerializer ++
+Implements an XHTML serializer supporting both DOM and SAX
+ pretty serializing. For usage instructions see either Serializer
or BaseMarkupSerializer
.
+
+
Serializer
Fields inherited from class org.apache.xml.serialize.HTMLSerializer | +
XHTMLNamespace |
+
Fields inherited from class org.apache.xml.serialize.BaseMarkupSerializer | +
_docTypePublicId,
+_docTypeSystemId,
+_format,
+_indenting,
+_prefixes,
+_printer,
+_started |
+
+Constructor Summary | +|
XHTMLSerializer()
+
++ Constructs a new serializer. |
+|
XHTMLSerializer(OutputFormat format)
+
++ Constructs a new serializer. |
+|
XHTMLSerializer(java.io.OutputStream output,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified output + stream using the specified output format. |
+|
XHTMLSerializer(java.io.Writer writer,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified writer + using the specified output format. |
+
+Method Summary | +|
+ void |
+setOutputFormat(OutputFormat format)
+
++ Specifies an output format for this serializer. |
+
Methods inherited from class org.apache.xml.serialize.HTMLSerializer | +
characters,
+characters,
+endElement,
+endElement,
+endElementIO,
+escapeURI,
+getEntityRef,
+serializeElement,
+startDocument,
+startElement,
+startElement |
+
Methods inherited from class org.apache.xml.serialize.BaseMarkupSerializer | +
asContentHandler,
+asDocumentHandler,
+asDOMSerializer,
+attributeDecl,
+comment,
+comment,
+content,
+elementDecl,
+endCDATA,
+endDocument,
+endDTD,
+endEntity,
+endNonEscaping,
+endPrefixMapping,
+endPreserving,
+enterElementState,
+externalEntityDecl,
+getElementState,
+getPrefix,
+ignorableWhitespace,
+internalEntityDecl,
+isDocumentState,
+leaveElementState,
+notationDecl,
+prepare,
+printDoctypeURL,
+printEscaped,
+printEscaped,
+printText,
+printText,
+processingInstruction,
+processingInstructionIO,
+reset,
+serialize,
+serialize,
+serialize,
+serializeNode,
+serializePreRoot,
+setDocumentLocator,
+setOutputByteStream,
+setOutputCharStream,
+skippedEntity,
+startCDATA,
+startDocument,
+startDTD,
+startEntity,
+startNonEscaping,
+startPrefixMapping,
+startPreserving,
+unparsedEntityDecl |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Constructor Detail | +
+public XHTMLSerializer()+
BaseMarkupSerializer.setOutputCharStream(java.io.Writer)
or BaseMarkupSerializer.setOutputByteStream(java.io.OutputStream)
+ first.+public XHTMLSerializer(OutputFormat format)+
BaseMarkupSerializer.setOutputCharStream(java.io.Writer)
or BaseMarkupSerializer.setOutputByteStream(java.io.OutputStream)
+ first.+public XHTMLSerializer(java.io.Writer writer, + OutputFormat format)+
writer
- The writer to useformat
- The output format to use, null for the default+public XHTMLSerializer(java.io.OutputStream output, + OutputFormat format)+
output
- The output stream to useformat
- The output format to use, null for the default+Method Detail | +
+public void setOutputFormat(OutputFormat format)+
format
- The output format to use
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.apache.xml.serialize.BaseMarkupSerializer + | + +--org.apache.xml.serialize.XMLSerializer ++
+Implements an XML serializer supporting both DOM and SAX pretty
+ serializing. For usage instructions see Serializer
.
+
+ If an output stream is used, the encoding is taken from the + output format (defaults to UTF-8). If a writer is + used, make sure the writer uses the same encoding (if applies) + as specified in the output format. +
+ The serializer supports both DOM and SAX. DOM serializing is done
+ by calling BaseMarkupSerializer.serialize(org.w3c.dom.Element)
and SAX serializing is done by firing
+ SAX events and using the serializer as a document handler.
+
+ If an I/O exception occurs while serializing, the serializer
+ will not throw an exception directly, but only throw it
+ at the end of serializing (either DOM or SAX's DocumentHandler.endDocument()
.
+
+ For elements that are not specified as whitespace preserving, + the serializer will potentially break long text lines at space + boundaries, indent lines, and serialize elements on separate + lines. Line terminators will be regarded as spaces, and + spaces at beginning of line will be stripped. +
+
Serializer
Fields inherited from class org.apache.xml.serialize.BaseMarkupSerializer | +
_docTypePublicId,
+_docTypeSystemId,
+_format,
+_indenting,
+_prefixes,
+_printer,
+_started |
+
+Constructor Summary | +|
XMLSerializer()
+
++ Constructs a new serializer. |
+|
XMLSerializer(OutputFormat format)
+
++ Constructs a new serializer. |
+|
XMLSerializer(java.io.OutputStream output,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified output + stream using the specified output format. |
+|
XMLSerializer(java.io.Writer writer,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified writer + using the specified output format. |
+
+Method Summary | +|
+ void |
+endElement(java.lang.String tagName)
+
++ Receive notification of the end of an element. |
+
+ void |
+endElement(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName)
+
++ Receive notification of the end of an element. |
+
+ void |
+endElementIO(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName)
+
++ |
+
+protected java.lang.String |
+getEntityRef(int ch)
+
++ Returns the suitable entity reference for this character value, + or null if no such entity exists. |
+
+protected void |
+serializeElement(Element elem)
+
++ Called to serialize a DOM element. |
+
+ void |
+setOutputFormat(OutputFormat format)
+
++ Specifies an output format for this serializer. |
+
+protected void |
+startDocument(java.lang.String rootTagName)
+
++ Called to serialize the document's DOCTYPE by the root element. |
+
+ void |
+startElement(java.lang.String tagName,
+ AttributeList attrs)
+
++ Receive notification of the beginning of an element. |
+
+ void |
+startElement(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName,
+ Attributes attrs)
+
++ Receive notification of the beginning of an element. |
+
Methods inherited from class org.apache.xml.serialize.BaseMarkupSerializer | +
asContentHandler,
+asDocumentHandler,
+asDOMSerializer,
+attributeDecl,
+characters,
+characters,
+comment,
+comment,
+content,
+elementDecl,
+endCDATA,
+endDocument,
+endDTD,
+endEntity,
+endNonEscaping,
+endPrefixMapping,
+endPreserving,
+enterElementState,
+externalEntityDecl,
+getElementState,
+getPrefix,
+ignorableWhitespace,
+internalEntityDecl,
+isDocumentState,
+leaveElementState,
+notationDecl,
+prepare,
+printDoctypeURL,
+printEscaped,
+printEscaped,
+printText,
+printText,
+processingInstruction,
+processingInstructionIO,
+reset,
+serialize,
+serialize,
+serialize,
+serializeNode,
+serializePreRoot,
+setDocumentLocator,
+setOutputByteStream,
+setOutputCharStream,
+skippedEntity,
+startCDATA,
+startDocument,
+startDTD,
+startEntity,
+startNonEscaping,
+startPrefixMapping,
+startPreserving,
+unparsedEntityDecl |
+
Methods inherited from class java.lang.Object | +
clone,
+equals,
+finalize,
+getClass,
+hashCode,
+notify,
+notifyAll,
+toString,
+wait,
+wait,
+wait |
+
+Constructor Detail | +
+public XMLSerializer()+
BaseMarkupSerializer.setOutputCharStream(java.io.Writer)
or BaseMarkupSerializer.setOutputByteStream(java.io.OutputStream)
+ first.+public XMLSerializer(OutputFormat format)+
BaseMarkupSerializer.setOutputCharStream(java.io.Writer)
or BaseMarkupSerializer.setOutputByteStream(java.io.OutputStream)
+ first.+public XMLSerializer(java.io.Writer writer, + OutputFormat format)+
writer
- The writer to useformat
- The output format to use, null for the default+public XMLSerializer(java.io.OutputStream output, + OutputFormat format)+
output
- The output stream to useformat
- The output format to use, null for the default+Method Detail | +
+public void setOutputFormat(OutputFormat format)+
format
- The output format to use+public void startElement(java.lang.String namespaceURI, + java.lang.String localName, + java.lang.String rawName, + Attributes attrs) + throws SAXException+
The Parser will invoke this method at the beginning of every
+ element in the XML document; there will be a corresponding
+ endElement
event for every startElement event
+ (even when the element is empty). All of the element's content will be
+ reported, in order, before the corresponding endElement
+ event.
This event allows up to three name components for each + element:
+ +Any or all of these may be provided, depending on the + values of the http://xml.org/sax/features/namespaces + and the http://xml.org/sax/features/namespace-prefixes + properties:
+ +Note that the attribute list provided will contain only
+ attributes with explicit values (specified or defaulted):
+ #IMPLIED attributes will be omitted. The attribute list
+ will contain attributes used for Namespace declarations
+ (xmlns* attributes) only if the
+ http://xml.org/sax/features/namespace-prefixes
+ property is true (it is false by default, and support for a
+ true value is optional).
uri
- 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.ContentHandler.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 rawName) + throws SAXException+
The SAX parser will invoke this method at the end of every
+ element in the XML document; there will be a corresponding
+ startElement
event for every endElement
+ event (even when the element is empty).
For information on the names, see startElement.
uri
- 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.+public void endElementIO(java.lang.String namespaceURI, + java.lang.String localName, + java.lang.String rawName) + throws java.io.IOException+
+public void startElement(java.lang.String tagName, + AttributeList attrs) + throws SAXException+
The Parser will invoke this method at the beginning of every + element in the XML document; there will be a corresponding + endElement() event for every startElement() event (even when the + element is empty). All of the element's content will be + reported, in order, before the corresponding endElement() + event.
+ +If the element name has a namespace prefix, the prefix will + still be attached. Note that the attribute list provided will + contain only attributes with explicit values (specified or + defaulted): #IMPLIED attributes will be omitted.
name
- The element type name.atts
- The attributes attached to the element, if any.DocumentHandler.endElement(java.lang.String)
,
+AttributeList
+public void endElement(java.lang.String tagName) + throws SAXException+
The SAX parser will invoke this method at the end of every + element in the XML document; there will be a corresponding + startElement() event for every endElement() event (even when the + element is empty).
+ +If the element name has a namespace prefix, the prefix will + still be attached to the name.
name
- The element type name+protected void startDocument(java.lang.String rootTagName) + throws java.io.IOException+
+ This method will check if it has not been called before (BaseMarkupSerializer._started
),
+ will serialize the document type declaration, and will serialize all
+ pre-root comments and PIs that were accumulated in the document
+ (see BaseMarkupSerializer.serializePreRoot()
). Pre-root will be serialized even if
+ this is not the first root element of the document.
+protected void serializeElement(Element elem) + throws java.io.IOException+
startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
, endElement(java.lang.String, java.lang.String, java.lang.String)
and serializing everything
+ inbetween, but better optimized.elem
- The element to serialize+protected java.lang.String getEntityRef(int ch)+
ch
- Character value
+
+
|
++ + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES | +|||||||||
+ SUMMARY: INNER | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use BaseMarkupSerializer | +|
org.apache.xml.serialize | ++ |
+Uses of BaseMarkupSerializer in org.apache.xml.serialize | +
+ +
Subclasses of BaseMarkupSerializer in org.apache.xml.serialize | +|
+ class |
+HTMLSerializer
+
++ Implements an HTML/XHTML serializer supporting both DOM and SAX + pretty serializing. |
+
+ class |
+TextSerializer
+
++ Implements a text serializer supporting both DOM and SAX + serializing. |
+
+ class |
+XHTMLSerializer
+
++ Implements an XHTML serializer supporting both DOM and SAX + pretty serializing. |
+
+ class |
+XMLSerializer
+
++ Implements an XML serializer supporting both DOM and SAX pretty + serializing. |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use DOMSerializer | +|
org.apache.xml.serialize | ++ |
+Uses of DOMSerializer in org.apache.xml.serialize | +
+ +
Classes in org.apache.xml.serialize that implement DOMSerializer | +|
+ class |
+BaseMarkupSerializer
+
++ Base class for a serializer supporting both DOM and SAX pretty + serializing of XML/HTML/XHTML documents. |
+
+ class |
+HTMLSerializer
+
++ Implements an HTML/XHTML serializer supporting both DOM and SAX + pretty serializing. |
+
+ class |
+TextSerializer
+
++ Implements a text serializer supporting both DOM and SAX + serializing. |
+
+ class |
+XHTMLSerializer
+
++ Implements an XHTML serializer supporting both DOM and SAX + pretty serializing. |
+
+ class |
+XMLSerializer
+
++ Implements an XML serializer supporting both DOM and SAX pretty + serializing. |
+
+ +
Methods in org.apache.xml.serialize that return DOMSerializer | +|
+ DOMSerializer |
+BaseMarkupSerializer.asDOMSerializer()
+
++ |
+
+ DOMSerializer |
+Serializer.asDOMSerializer()
+
++ Return a DOMSerializer interface into this serializer. |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use ElementState | +|
org.apache.xml.serialize | ++ |
+Uses of ElementState in org.apache.xml.serialize | +
+ +
Methods in org.apache.xml.serialize that return ElementState | +|
+protected ElementState |
+BaseMarkupSerializer.content()
+
++ Must be called by a method about to print any type of content. |
+
+protected ElementState |
+BaseMarkupSerializer.getElementState()
+
++ Return the state of the current element. |
+
+protected ElementState |
+BaseMarkupSerializer.enterElementState(java.lang.String namespaceURI,
+ java.lang.String localName,
+ java.lang.String rawName,
+ boolean preserveSpace)
+
++ Enter a new element state for the specified element. |
+
+protected ElementState |
+BaseMarkupSerializer.leaveElementState()
+
++ Leave the current element state and return to the + state of the parent element. |
+
+protected ElementState |
+TextSerializer.content()
+
++ |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use EncodingInfo | +|
org.apache.xml.serialize | ++ |
+Uses of EncodingInfo in org.apache.xml.serialize | +
+ +
Subclasses of EncodingInfo in org.apache.xml.serialize | +|
+ class |
+SieveEncodingInfo
+
++ This class represents an encoding. |
+
+ +
Methods in org.apache.xml.serialize that return EncodingInfo | +|
+ EncodingInfo |
+OutputFormat.getEncodingInfo()
+
++ Returns an EncodingInfo |
+
+ +
Methods in org.apache.xml.serialize with parameters of type EncodingInfo | +|
+ void |
+OutputFormat.setEncoding(EncodingInfo encInfo)
+
++ Sets the encoding for this output method with an EncodingInfo
+ instance. |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use HTMLSerializer | +|
org.apache.xml.serialize | ++ |
+Uses of HTMLSerializer in org.apache.xml.serialize | +
+ +
Subclasses of HTMLSerializer in org.apache.xml.serialize | +|
+ class |
+XHTMLSerializer
+
++ Implements an XHTML serializer supporting both DOM and SAX + pretty serializing. |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use OutputFormat | +|
org.apache.xml.serialize | ++ |
+Uses of OutputFormat in org.apache.xml.serialize | +
+ +
Fields in org.apache.xml.serialize declared as OutputFormat | +|
+protected OutputFormat |
+Printer._format
+
++ The output format associated with this serializer. |
+
+protected OutputFormat |
+BaseMarkupSerializer._format
+
++ The output format associated with this serializer. |
+
+ +
Methods in org.apache.xml.serialize with parameters of type OutputFormat | +|
+ void |
+BaseMarkupSerializer.setOutputFormat(OutputFormat format)
+
++ |
+
+ void |
+HTMLSerializer.setOutputFormat(OutputFormat format)
+
++ |
+
+ void |
+XHTMLSerializer.setOutputFormat(OutputFormat format)
+
++ |
+
+ void |
+TextSerializer.setOutputFormat(OutputFormat format)
+
++ |
+
+ void |
+Serializer.setOutputFormat(OutputFormat format)
+
++ Specifies an output format for this serializer. |
+
+ void |
+XMLSerializer.setOutputFormat(OutputFormat format)
+
++ |
+
+abstract Serializer |
+SerializerFactory.makeSerializer(OutputFormat format)
+
++ Create a new serializer based on the OutputFormat . |
+
+abstract Serializer |
+SerializerFactory.makeSerializer(java.io.Writer writer,
+ OutputFormat format)
+
++ Create a new serializer, based on the OutputFormat and
+ using the writer as the output character stream. |
+
+abstract Serializer |
+SerializerFactory.makeSerializer(java.io.OutputStream output,
+ OutputFormat format)
+
++ Create a new serializer, based on the OutputFormat and
+ using the output byte stream and the encoding specified in the
+ output format. |
+
+ +
Constructors in org.apache.xml.serialize with parameters of type OutputFormat | +|
Printer.Printer(java.io.Writer writer,
+ OutputFormat format)
+
++ |
+|
BaseMarkupSerializer.BaseMarkupSerializer(OutputFormat format)
+
++ Protected constructor can only be used by derived class. |
+|
HTMLSerializer.HTMLSerializer(boolean xhtml,
+ OutputFormat format)
+
++ Constructs a new HTML/XHTML serializer depending on the value of + xhtml. |
+|
HTMLSerializer.HTMLSerializer(OutputFormat format)
+
++ Constructs a new serializer. |
+|
HTMLSerializer.HTMLSerializer(java.io.Writer writer,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified writer + using the specified output format. |
+|
HTMLSerializer.HTMLSerializer(java.io.OutputStream output,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified output + stream using the specified output format. |
+|
XHTMLSerializer.XHTMLSerializer(OutputFormat format)
+
++ Constructs a new serializer. |
+|
XHTMLSerializer.XHTMLSerializer(java.io.Writer writer,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified writer + using the specified output format. |
+|
XHTMLSerializer.XHTMLSerializer(java.io.OutputStream output,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified output + stream using the specified output format. |
+|
XMLSerializer.XMLSerializer(OutputFormat format)
+
++ Constructs a new serializer. |
+|
XMLSerializer.XMLSerializer(java.io.Writer writer,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified writer + using the specified output format. |
+|
XMLSerializer.XMLSerializer(java.io.OutputStream output,
+ OutputFormat format)
+
++ Constructs a new serializer that writes to the specified output + stream using the specified output format. |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use Printer | +|
org.apache.xml.serialize | ++ |
+Uses of Printer in org.apache.xml.serialize | +
+ +
Subclasses of Printer in org.apache.xml.serialize | +|
+ class |
+IndentPrinter
+
++ Extends Printer and adds support for indentation and line
+ wrapping. |
+
+ +
Fields in org.apache.xml.serialize declared as Printer | +|
+protected Printer |
+BaseMarkupSerializer._printer
+
++ The printer used for printing text parts. |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use Serializer | +|
org.apache.xml.serialize | ++ |
+Uses of Serializer in org.apache.xml.serialize | +
+ +
Classes in org.apache.xml.serialize that implement Serializer | +|
+ class |
+BaseMarkupSerializer
+
++ Base class for a serializer supporting both DOM and SAX pretty + serializing of XML/HTML/XHTML documents. |
+
+ class |
+HTMLSerializer
+
++ Implements an HTML/XHTML serializer supporting both DOM and SAX + pretty serializing. |
+
+ class |
+TextSerializer
+
++ Implements a text serializer supporting both DOM and SAX + serializing. |
+
+ class |
+XHTMLSerializer
+
++ Implements an XHTML serializer supporting both DOM and SAX + pretty serializing. |
+
+ class |
+XMLSerializer
+
++ Implements an XML serializer supporting both DOM and SAX pretty + serializing. |
+
+ +
Methods in org.apache.xml.serialize that return Serializer | +|
+abstract Serializer |
+SerializerFactory.makeSerializer(OutputFormat format)
+
++ Create a new serializer based on the OutputFormat . |
+
+abstract Serializer |
+SerializerFactory.makeSerializer(java.io.Writer writer,
+ OutputFormat format)
+
++ Create a new serializer, based on the OutputFormat and
+ using the writer as the output character stream. |
+
+abstract Serializer |
+SerializerFactory.makeSerializer(java.io.OutputStream output,
+ OutputFormat format)
+
++ Create a new serializer, based on the OutputFormat and
+ using the output byte stream and the encoding specified in the
+ output format. |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use SerializerFactory | +|
org.apache.xml.serialize | ++ |
+Uses of SerializerFactory in org.apache.xml.serialize | +
+ +
Methods in org.apache.xml.serialize that return SerializerFactory | +|
+static SerializerFactory |
+SerializerFactory.getSerializerFactory(java.lang.String method)
+
++ Register a serializer factory, keyed by the given + method string. |
+
+ +
Methods in org.apache.xml.serialize with parameters of type SerializerFactory | +|
+static void |
+SerializerFactory.registerSerializerFactory(SerializerFactory factory)
+
++ Register a serializer factory, keyed by the given + method string. |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Interfaces
+
+ +DOMSerializer + +Serializer |
+
+Classes
+
+ +BaseMarkupSerializer + +ElementState + +EncodingInfo + +Encodings + +HTMLdtd + +HTMLSerializer + +IndentPrinter + +LineSeparator + +Method + +OutputFormat + +OutputFormat.Defaults + +OutputFormat.DTD + +Printer + +SerializerFactory + +SieveEncodingInfo + +TextSerializer + +XHTMLSerializer + +XMLSerializer |
+
+
+
|
++ + | +|||||||||
+ PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES | +
+Interface Summary | +|
DOMSerializer | +Interface for a DOM serializer implementation. | +
Serializer | +Interface for a DOM serializer implementation, factory for DOM and SAX + serializers, and static methods for serializing DOM documents. | +
+ +
+Class Summary | +|
BaseMarkupSerializer | +Base class for a serializer supporting both DOM and SAX pretty + serializing of XML/HTML/XHTML documents. | +
ElementState | +Holds the state of the currently serialized element. | +
EncodingInfo | +This class represents an encoding. | +
Encodings | +Provides information about encodings. | +
HTMLdtd | +Utility class for accessing information specific to HTML documents. | +
HTMLSerializer | +Implements an HTML/XHTML serializer supporting both DOM and SAX + pretty serializing. | +
IndentPrinter | +Extends Printer and adds support for indentation and line
+ wrapping. |
+
LineSeparator | ++ |
Method | ++ |
OutputFormat | +Specifies an output format to control the serializer. | +
OutputFormat.Defaults | ++ |
OutputFormat.DTD | ++ |
Printer | +The printer is responsible for sending text to the output stream + or writer. | +
SerializerFactory | ++ |
SieveEncodingInfo | +This class represents an encoding. | +
TextSerializer | +Implements a text serializer supporting both DOM and SAX + serializing. | +
XHTMLSerializer | +Implements an XHTML serializer supporting both DOM and SAX + pretty serializing. | +
XMLSerializer | +Implements an XML serializer supporting both DOM and SAX pretty + serializing. | +
+
+
+
|
++ + | +|||||||||
+ PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +
+Packages that use org.apache.xml.serialize | +|
org.apache.xml.serialize | ++ |
+Classes in org.apache.xml.serialize used by org.apache.xml.serializeBaseMarkupSerializer
+
+ |
++ Base class for a serializer supporting both DOM and SAX pretty + serializing of XML/HTML/XHTML documents. DOMSerializer
+
+ |
++ Interface for a DOM serializer implementation. ElementState
+
+ |
++ Holds the state of the currently serialized element. EncodingInfo
+
+ |
++ This class represents an encoding. HTMLSerializer
+
+ |
++ Implements an HTML/XHTML serializer supporting both DOM and SAX + pretty serializing. OutputFormat
+
+ |
++ Specifies an output format to control the serializer. Printer
+
+ |
++ The printer is responsible for sending text to the output stream + or writer. Serializer
+
+ |
++ Interface for a DOM serializer implementation, factory for DOM and SAX + serializers, and static methods for serializing DOM documents. SerializerFactory
+
+ |
++ |
+
+
+
+
|
++ + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES | +