|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface XmlTokenSource
Represents a holder of XML that can return an XmlCursor
or copy itself to various media such as
Writers
or Files
.
Both XmlObject
(and thus all XML Beans) and XmlCursor
are
XmlTokenSource implementations.
XmlObject
,
XmlCursor
Method Summary | |
---|---|
XmlDocumentProperties |
documentProperties()
Returns the XmlDocumentProperties object for the document this token source is associated with. |
void |
dump()
Prints to stdout the state of the document in which this token source is positioned. |
Node |
getDomNode()
Returns a W3C DOM Node containing the XML represented by this source. |
java.lang.Object |
monitor()
Returns the synchronization object for the document. |
XmlCursor |
newCursor()
Returns a new XML cursor. |
Node |
newDomNode()
Returns a W3C DOM Node containing the XML represented by this source. |
Node |
newDomNode(XmlOptions options)
Just like newDomNode() but with options. |
java.io.InputStream |
newInputStream()
Returns a new stream containing standard XML text, encoded according to the given encoding. |
java.io.InputStream |
newInputStream(XmlOptions options)
Just like newInputStream(String encoding) but with options. |
java.io.Reader |
newReader()
Returns a new character reader containing XML text. |
java.io.Reader |
newReader(XmlOptions options)
Just like newReader() but with options. |
XMLInputStream |
newXMLInputStream()
Deprecated. XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. |
XMLInputStream |
newXMLInputStream(XmlOptions options)
Deprecated. XMLInputStream was deprecated by XMLStreamReader from STaX - jsr173 API. |
javax.xml.stream.XMLStreamReader |
newXMLStreamReader()
Returns a new XMLStreamReader. |
javax.xml.stream.XMLStreamReader |
newXMLStreamReader(XmlOptions options)
Just like newXMLInputStream() but with options. |
void |
save(ContentHandler ch,
LexicalHandler lh)
Writes the XML represented by this source to the given SAX content and lexical handlers. |
void |
save(ContentHandler ch,
LexicalHandler lh,
XmlOptions options)
Writes the XML represented by this source to the given SAX content and lexical handlers. |
void |
save(java.io.File file)
Writes the XML represented by this source to the given File. |
void |
save(java.io.File file,
XmlOptions options)
Writes the XML represented by this source to the given File. |
void |
save(java.io.OutputStream os)
Writes the XML represented by this source to the given output stream. |
void |
save(java.io.OutputStream os,
XmlOptions options)
Writes the XML represented by this source to the given output stream. |
void |
save(java.io.Writer w)
Writes the XML represented by this source to the given output. |
void |
save(java.io.Writer w,
XmlOptions options)
Writes the XML represented by this source to the given output. |
java.lang.String |
xmlText()
Returns standard XML text. |
java.lang.String |
xmlText(XmlOptions options)
Just like xmlText() but with options. |
Method Detail |
---|
java.lang.Object monitor()
XmlDocumentProperties documentProperties()
XmlCursor newCursor()
XMLInputStream newXMLInputStream()
javax.xml.stream.XMLStreamReader newXMLStreamReader()
java.lang.String xmlText()
The text returned represents the document contents starting at the current begin-tag or begin-document and ending at the matching end-tag or end-document. This is same content as newReader, but it is returned as a single string.
Throws an IllegalStateException if the XmlTokenSource is not positioned at begin-tag or begin-document (e.g., if it is at an attribute).
Note that this method does not produce XML with the XML declaration,
including the encoding information. To save the XML declaration with
the XML, see save(OutputStream)
or save(OutputStream, XmlOptions)
.
java.io.InputStream newInputStream()
java.io.Reader newReader()
Node newDomNode()
Node getDomNode()
void save(ContentHandler ch, LexicalHandler lh) throws SAXException
save(OutputStream)
,
save(OutputStream, XmlOptions)
, save(File)
or save(File, XmlOptions)
.
SAXException
void save(java.io.File file) throws java.io.IOException
java.io.IOException
void save(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
void save(java.io.Writer w) throws java.io.IOException
save(OutputStream)
,
save(OutputStream, XmlOptions)
, save(File)
or save(File, XmlOptions)
.
java.io.IOException
XMLInputStream newXMLInputStream(XmlOptions options)
Just like newXMLInputStream() but with any of a number of options. Use the options parameter to specify the following:
To specify this | Use this method |
---|---|
The character encoding to use when converting the character data in the XML to bytess. | XmlOptions.setCharacterEncoding(java.lang.String) |
Prefix-to-namespace mappings that should be assumed when saving this XML. This is useful when the resulting XML will be part of a larger XML document, ensuring that this inner document will take advantage of namespaces defined in the outer document. | XmlOptions.setSaveImplicitNamespaces(java.util.Map) |
Suggested namespace prefixes to use when saving. Used only when a namespace attribute needs to be synthesized. | XmlOptions.setSaveSuggestedPrefixes(java.util.Map) |
That namespace attributes should occur first in elements when the XML is saved. By default, they occur last. | XmlOptions.setSaveNamespacesFirst() |
The XML should be pretty printed when saved. Note that this should only be used for debugging. | XmlOptions.setSavePrettyPrint() |
The number of spaces to use when indenting for pretty printing. The default is 2. | XmlOptions.setSavePrettyPrintIndent(int) |
The additional number of spaces indented from the left for pretty printed XML. | XmlOptions.setSavePrettyPrintOffset(int) |
To minimize the number of namespace attributes generated for the saved XML. Note that this can reduce performance significantly. | XmlOptions.setSaveAggresiveNamespaces() |
To reduce the size of the saved document by allowing the use of the default namespace. Note that this can potentially change the semantic meaning of the XML if unprefixed QNames are present as the value of an attribute or element. | XmlOptions.setUseDefaultNamespace() |
To filter out processing instructions with the specified target name. | XmlOptions.setSaveFilterProcinst(java.lang.String) |
Change the QName of the synthesized root element when saving. This replaces "xml-fragment" with "fragment" in the namespace http://www.openuri.org/fragment | XmlOptions.setSaveUseOpenFrag() |
Saving should begin on the element's contents. | XmlOptions.setSaveInner() |
Saving should begin on the element, rather than its contents. | XmlOptions.setSaveOuter() |
To rename the document element, or to specify the document element for this XML. | XmlOptions.setSaveSyntheticDocumentElement(javax.xml.namespace.QName) |
options
- Any of the described options.
XmlOptions
javax.xml.stream.XMLStreamReader newXMLStreamReader(XmlOptions options)
XmlOptions
java.lang.String xmlText(XmlOptions options)
Note that this method does not produce XML with the XML declaration,
including the encoding information. To save the XML declaration with
the XML, see save(OutputStream)
or save(OutputStream, XmlOptions)
.
XmlOptions
java.io.InputStream newInputStream(XmlOptions options)
XmlOptions
java.io.Reader newReader(XmlOptions options)
XmlOptions
Node newDomNode(XmlOptions options)
XmlOptions
void save(ContentHandler ch, LexicalHandler lh, XmlOptions options) throws SAXException
save(OutputStream)
,
save(OutputStream, XmlOptions)
, save(File)
or save(File, XmlOptions)
.
SAXException
void save(java.io.File file, XmlOptions options) throws java.io.IOException
java.io.IOException
void save(java.io.OutputStream os, XmlOptions options) throws java.io.IOException
java.io.IOException
void save(java.io.Writer w, XmlOptions options) throws java.io.IOException
save(OutputStream)
,
save(OutputStream, XmlOptions)
, save(File)
or save(File, XmlOptions)
.
java.io.IOException
void dump()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |