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. SAX serializing is done by firing SAX events and using the serializer as a document handler. DOM serializing is done by calling {@link #serialize(Document)} or by using DOM Level 3 {@link org.w3c.dom.ls.DOMSerializer} andserializing with {@link org.w3c.dom.ls.DOMSerializer#write}, {@link org.w3c.dom.ls.DOMSerializer#writeToString}.
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 {@link org.xml.sax.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. @author Assaf Arkin @author Rahul Srivastava @author Elena Litani IBM @version $Revision: 1.2.6.1 $ $Date: 2005/09/09 07:26:18 $ @see Serializer
This object coordinates the overall marshalling efforts across different content-tree objects and different target formats.
The following CFG gives the proper sequence of method invocation.
MARSHALLING := ELEMENT ELEMENT := "startElement" NSDECL* "endNamespaceDecls" ATTRIBUTE* "endAttributes" BODY "endElement" NSDECL := "declareNamespace" ATTRIBUTE := "attribute" ATTVALUES := "text" BODY := ( "text" | ELEMENT )
A marshalling of one element consists of two stages. The first stage is for marshalling attributes and collecting namespace declarations. The second stage is for marshalling characters/child elements of that element.
Observe that multiple invocation of "text" is allowed.
Also observe that the namespace declarations are allowed only between "startElement" and "endAttributes".
{@link IOException}, {@link SAXException}, and {@link XMLStreamException}are thrown from {@link XmlOutput}. They are always considered fatal, and therefore caught only by {@link MarshallerImpl}.
{@link AccessorException} can be thrown when an access to a property/fieldfails, and this is considered as a recoverable error, so it's caught everywhere. @author Kohsuke Kawaguchi
This object coordinates the overall marshalling efforts across different content-tree objects and different target formats.
The following CFG gives the proper sequence of method invocation.
MARSHALLING := ELEMENT ELEMENT := "startElement" NSDECL* "endNamespaceDecls" ATTRIBUTE* "endAttributes" BODY "endElement" NSDECL := "declareNamespace" ATTRIBUTE := "attribute" ATTVALUES := "text" BODY := ( "text" | ELEMENT )
A marshalling of one element consists of two stages. The first stage is for marshalling attributes and collecting namespace declarations. The second stage is for marshalling characters/child elements of that element.
Observe that multiple invocation of "text" is allowed.
Also observe that the namespace declarations are allowed only between "startElement" and "endAttributes".
{@link IOException}, {@link SAXException}, and {@link XMLStreamException}are thrown from {@link XmlOutput}. They are always considered fatal, and therefore caught only by {@link MarshallerImpl}.
{@link AccessorException} can be thrown when an access to a property/fieldfails, and this is considered as a recoverable error, so it's caught everywhere. @author Kohsuke Kawaguchi
Applications can use one of the predefined implementations to send TXW output to the desired location/format, or they can choose to implement this interface for custom output.
One {@link XmlSerializer} instance is responsible for writingone XML document.
WHOLE_SEQUENCE := startDocument ELEMENT endDocument ELEMENT := beginStartTag writeXmlns* writeAttribute* endStartTag CONTENT endTag CONTENT := (text|ELEMENT)
TXW maintains all the in-scope namespace bindings and prefix allocation. The {@link XmlSerializer} implementation should just use the prefixspecified.
@author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)Applications can use one of the predefined implementations to send TXW output to the desired location/format, or they can choose to implement this interface for custom output.
One {@link XmlSerializer} instance is responsible for writingone XML document.
WHOLE_SEQUENCE := startDocument ELEMENT endDocument ELEMENT := beginStartTag writeXmlns* writeAttribute* endStartTag CONTENT endTag CONTENT := (text|ELEMENT)
TXW maintains all the in-scope namespace bindings and prefix allocation. The {@link XmlSerializer} implementation should just use the prefixspecified.
@author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)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 {@link #serialize} and SAX serializing is done by firingSAX 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 {@link org.xml.sax.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. @version $Revision: 1.21 $ $Date: 2001/04/19 23:40:32 $ @author Assaf Arkin @see Serializer
PLEASE NOTE: This interface will be part of XmlPull 1.2 API. It is included as basis for discussion. It may change in any way.
Exceptions that may be thrown are: IOException or runtime exception (more runtime exceptions can be thrown but are not declared and as such have no semantics defined for this interface):
NOTE: writing CDSECT, ENTITY_REF, IGNORABLE_WHITESPACE, PROCESSING_INSTRUCTION, COMMENT, and DOCDECL in some implementations may not be supported (for example when serializing to WBXML). In such case IllegalStateException will be thrown and it is recommended to use an optional feature to signal that implementation is not supporting this kind of output.
Abstract XML serializer - contains common logic for descendants.
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. SAX serializing is done by firing SAX events and using the serializer as a document handler. DOM serializing is done by calling {@link #serialize(Document)} or by using DOM Level 3{@link org.w3c.dom.ls.LSSerializer} andserializing with {@link org.w3c.dom.ls.LSSerializer#write}, {@link org.w3c.dom.ls.LSSerializer#writeToString}.
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 {@link org.xml.sax.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. @author Assaf Arkin @author Rahul Srivastava @author Elena Litani IBM @version $Revision: 19776 $ $Date: 2010-01-14 16:17:21 -0600 (Thu, 14 Jan 2010) $ @see Serializer
an example of produced xml:
<?xml version="1.0" encoding="UTF-8"?> <Reflections> <org.reflections.scanners.MethodAnnotationsScanner> <entry> <key>org.reflections.TestModel$AM1</key> <values> <value>org.reflections.TestModel$C4.m3()</value> <value>org.reflections.TestModel$C4.m1(int[][], java.lang.String[][])</value> ...
an example of produced xml:
<?xml version="1.0" encoding="UTF-8"?> <Reflections> <org.reflections.scanners.MethodAnnotationsScanner> <entry> <key>org.reflections.TestModel$AM1</key> <values> <value>org.reflections.TestModel$C4.m3()</value> <value>org.reflections.TestModel$C4.m1(int[][], java.lang.String[][])</value> ...
This object coordinates the overall marshalling efforts across different content-tree objects and different target formats.
The following CFG gives the proper sequence of method invocation.
MARSHALLING := ELEMENT ELEMENT := "startElement" NSDECL* "endNamespaceDecls" ATTRIBUTE* "endAttributes" BODY "endElement" NSDECL := "declareNamespace" ATTRIBUTE := "startAttribute" ATTVALUES "endAttribute" ATTVALUES := "text" BODY := ( "text" | ELEMENT )
A marshalling of one element consists of two stages. The first stage is for marshalling attributes and collecting namespace declarations. The second stage is for marshalling characters/child elements of that element.
Observe that multiple invocation of "text" is allowed.
Also observe that the namespace declarations are allowed only between "startElement" and "endAttributes". @author Kohsuke Kawaguchi
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 {@link #serialize} and SAX serializing is done by firingSAX 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 {@link org.xml.sax.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. @version $Revision: 1.2 $ $Date: 2006/10/06 13:27:08 $ @author Assaf Arkin @see Serializer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|