Object
Static factory class for creating new instances. Note that if a type can be inferred from the XML being loaded (for example, by recognizing the document element QName), then the instance returned by a factory will have the inferred type. Otherwise the Factory will returned an untyped document.
Object
XmlObject.Factory
XmlObject
Method Summary |
public static |
|
public static |
|
public static |
|
public static |
|
public static | |
public static |
|
public static |
|
public static | |
public static |
|
public static | |
public static |
|
public static | |
public static |
|
public static |
|
public static |
|
public static | |
public static |
|
public static | |
public static |
|
public static |
|
public static |
|
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static XmlObject
newInstance()
Creates a new, completely empty instance.
public staticXmlObject
newInstance(XmlOptions
options)
Creates a new, completely empty instance, specifying options for the root element's document type and/or whether to validate value facets as they are set.
Use the options parameter to specify the following:To specify this | Use this method |
---|---|
The document type for the root element. | XmlOptions.setDocumentType(SchemaType)
|
Whether value facets should be checked as they are set. | XmlOptions.setValidateOnSet()
|
DEPRECATED Superceded by JSR 173
public staticReturns a new validatingXMLInputStream
newValidatingXMLInputStream(XMLInputStream
xis)
throwsXmlException
,XMLStreamException
XMLInputStream
that throws exceptions when the input is not valid.
XmlException
XMLStreamException
DEPRECATED Superceded by JSR 173
public staticReturns a new validatingXMLInputStream
newValidatingXMLInputStream(XMLInputStream
xis,XmlOptions
options)
throwsXmlException
,XMLStreamException
XMLInputStream
that throws exceptions
when the input is not valid, specifying options
for the root element's document type and/or the collection object to use
as an error listener while validating.
Use the options parameter to specify the following:
XmlOptions.setErrorListener(Collection)
.XmlOptions.setDocumentType(SchemaType)
.XmlException
XMLStreamException
public staticCreates an immutableXmlObject
newValue(Object
obj)
XmlObject
value
public static XmlSaxHandler
newXmlSaxHandler()
Returns an XmlSaxHandler
that can load an XmlObject from SAX events.
public staticReturns anXmlSaxHandler
newXmlSaxHandler(XmlOptions
options)
XmlSaxHandler
that can load an XmlObject from SAX events.
public staticParses the givenXmlObject
parse(String
s)
throwsXmlException
String
as XML.
XmlException
public staticParses the givenXmlObject
parse(String
s,XmlOptions
options)
throwsXmlException
String
as XML.
Use the options parameter to specify the following:
To specify this | Use this method |
---|---|
The document type for the root element. | XmlOptions.setDocumentType(SchemaType)
|
To place line number annotations in the store when parsing a document. | XmlOptions.setLoadLineNumbers()
|
To replace the document element with the specified QName when parsing. | XmlOptions.setLoadReplaceDocumentElement(QName)
|
To strip all insignificant whitespace when parsing a document. | XmlOptions.setLoadStripWhitespace()
|
To strip all comments when parsing a document. | XmlOptions.setLoadStripComments()
|
To strip all processing instructions when parsing a document. | XmlOptions.setLoadStripProcinsts()
|
A map of namespace URI substitutions to use when parsing a document. | XmlOptions.setLoadSubstituteNamespaces(Map)
|
Additional namespace mappings to be added when parsing a document. | XmlOptions.setLoadAdditionalNamespaces(Map)
|
To trim the underlying XML text buffer immediately after parsing a document, resulting in a smaller memory footprint. | XmlOptions.setLoadTrimTextBuffer()
|
XmlException
public staticParses the givenXmlObject
parse(File
f)
throwsXmlException
,IOException
File
as XML.
XmlException
IOException
public staticParses the givenXmlObject
parse(File
f,XmlOptions
options)
throwsXmlException
,IOException
File
as XML.
XmlException
IOException
public staticDownloads the givenXmlObject
parse(URL
u)
throwsXmlException
,IOException
URL
as XML.
XmlException
IOException
public staticDownloads the givenXmlObject
parse(URL
u,XmlOptions
options)
throwsXmlException
,IOException
URL
as XML.
XmlException
IOException
public staticDecodes and parses the givenXmlObject
parse(InputStream
is)
throwsXmlException
,IOException
InputStream
as XML.
XmlException
IOException
public staticDecodes and parses the givenXmlObject
parse(InputStream
is,XmlOptions
options)
throwsXmlException
,IOException
InputStream
as XML.
Use the options parameter to specify the following:
To specify this | Use this method |
---|---|
The character encoding to use when parsing or writing a document. | XmlOptions.setCharacterEncoding(String)
|
The document type for the root element. | XmlOptions.setDocumentType(SchemaType)
|
Place line number annotations in the store when parsing a document. | XmlOptions.setLoadLineNumbers()
|
Replace the document element with the specified QName when parsing. | XmlOptions.setLoadReplaceDocumentElement(QName)
|
Strip all insignificant whitespace when parsing a document. | XmlOptions.setLoadStripWhitespace()
|
Strip all comments when parsing a document. | XmlOptions.setLoadStripComments()
|
Strip all processing instructions when parsing a document. | XmlOptions.setLoadStripProcinsts()
|
Set a map of namespace URI substitutions to use when parsing a document. | XmlOptions.setLoadSubstituteNamespaces(Map)
|
Set additional namespace mappings to be added when parsing a document. | XmlOptions.setLoadAdditionalNamespaces(Map)
|
Trim the underlying XML text buffer immediately after parsing a document, resulting in a smaller memory footprint. | XmlOptions.setLoadTrimTextBuffer()
|
XmlException
IOException
public staticParses the givenXmlObject
parse(Reader
r)
throwsXmlException
,IOException
Reader
as XML.
XmlException
IOException
public staticParses the givenXmlObject
parse(Reader
r,XmlOptions
options)
throwsXmlException
,IOException
Reader
as XML.
XmlException
IOException
public staticConverts the given DOMXmlObject
parse(Node
node)
throwsXmlException
Node
into an XmlObject.
XmlException
public staticConverts the given DOMXmlObject
parse(Node
node,XmlOptions
options)
throwsXmlException
Node
into an XmlObject.
XmlException
DEPRECATED Superceded by JSR 173
public staticLoads the givenXmlObject
parse(XMLInputStream
xis)
throwsXmlException
,XMLStreamException
XMLInputStream
into an XmlObject.
XmlException
XMLStreamException
DEPRECATED Superceded by JSR 173
public staticLoads the givenXmlObject
parse(XMLInputStream
xis,XmlOptions
options)
throwsXmlException
,XMLStreamException
XMLInputStream
into an XmlObject.
XmlException
XMLStreamException