public static final class XmlObject.Factory extends Object
Modifier and Type | Method and Description |
---|---|
static DOMImplementation |
newDomImplementation()
Creates a new DOMImplementation object
|
static DOMImplementation |
newDomImplementation(XmlOptions options)
Creates a new DOMImplementation object, taking options
|
static XmlObject |
newInstance()
Creates a new, completely empty instance.
|
static XmlObject |
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.
|
static XmlObject |
newValue(Object obj)
Creates an immutable
XmlObject value |
static XmlSaxHandler |
newXmlSaxHandler()
Returns an
XmlSaxHandler that can load an XmlObject from SAX events. |
static XmlSaxHandler |
newXmlSaxHandler(XmlOptions options)
Returns an
XmlSaxHandler that can load an XmlObject from SAX events. |
static XmlObject |
parse(File file)
Parses the given
File as XML. |
static XmlObject |
parse(File file,
XmlOptions options)
Parses the given
File as XML. |
static XmlObject |
parse(InputStream is)
Decodes and parses the given
InputStream as XML. |
static XmlObject |
parse(InputStream is,
XmlOptions options)
Decodes and parses the given
InputStream as XML. |
static XmlObject |
parse(Node node)
Converts the given DOM
Node into an XmlObject. |
static XmlObject |
parse(Node node,
XmlOptions options)
Converts the given DOM
Node into an XmlObject. |
static XmlObject |
parse(Reader r)
Parses the given
Reader as XML. |
static XmlObject |
parse(Reader r,
XmlOptions options)
Parses the given
Reader as XML. |
static XmlObject |
parse(String xmlAsString)
Parses the given
String as XML. |
static XmlObject |
parse(String xmlAsString,
XmlOptions options)
Parses the given
String as XML. |
static XmlObject |
parse(URL u)
Downloads the given
URL as XML. |
static XmlObject |
parse(URL u,
XmlOptions options)
Downloads the given
URL as XML. |
static XmlObject |
parse(XMLStreamReader xsr)
Decodes and parses the given
XMLStreamReader as XML. |
static XmlObject |
parse(XMLStreamReader xsr,
XmlOptions options)
Parses the given
XMLStreamReader as XML. |
public static XmlObject newInstance()
public static XmlObject 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(org.apache.xmlbeans.SchemaType) |
Whether value facets should be checked as they are set. | XmlOptions.setValidateOnSet() |
options
- Options specifying root document type and/or value facet
checking.public static XmlObject parse(String xmlAsString) throws XmlException
String
as XML.XmlException
public static XmlObject parse(String xmlAsString, XmlOptions options) throws XmlException
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(org.apache.xmlbeans.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(javax.xml.namespace.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(java.util.Map<java.lang.String, java.lang.String>) |
Additional namespace mappings to be added when parsing a document. | XmlOptions.setLoadAdditionalNamespaces(java.util.Map<java.lang.String, java.lang.String>) |
To trim the underlying XML text buffer immediately after parsing a document, resulting in a smaller memory footprint. | XmlOptions.setLoadTrimTextBuffer() |
xmlAsString
- The string to parse.options
- Options as specified.XmlException
public static XmlObject parse(File file) throws XmlException, IOException
File
as XML.XmlException
IOException
public static XmlObject parse(File file, XmlOptions options) throws XmlException, IOException
File
as XML.XmlException
IOException
public static XmlObject parse(URL u) throws XmlException, IOException
URL
as XML.XmlException
IOException
public static XmlObject parse(URL u, XmlOptions options) throws XmlException, IOException
URL
as XML.XmlException
IOException
public static XmlObject parse(InputStream is) throws XmlException, IOException
InputStream
as XML.XmlException
IOException
public static XmlObject parse(XMLStreamReader xsr) throws XmlException
XMLStreamReader
as XML.XmlException
public static XmlObject parse(InputStream is, XmlOptions options) throws XmlException, 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(java.lang.String) |
The document type for the root element. | XmlOptions.setDocumentType(org.apache.xmlbeans.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(javax.xml.namespace.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(java.util.Map<java.lang.String, java.lang.String>) |
Set additional namespace mappings to be added when parsing a document. | XmlOptions.setLoadAdditionalNamespaces(java.util.Map<java.lang.String, java.lang.String>) |
Trim the underlying XML text buffer immediately after parsing a document, resulting in a smaller memory footprint. | XmlOptions.setLoadTrimTextBuffer() |
XmlException
IOException
public static XmlObject parse(XMLStreamReader xsr, XmlOptions options) throws XmlException
XMLStreamReader
as XML.XmlException
public static XmlObject parse(Reader r) throws XmlException, IOException
Reader
as XML.XmlException
IOException
public static XmlObject parse(Reader r, XmlOptions options) throws XmlException, IOException
Reader
as XML.XmlException
IOException
public static XmlObject parse(Node node) throws XmlException
Node
into an XmlObject.XmlException
public static XmlObject parse(Node node, XmlOptions options) throws XmlException
Node
into an XmlObject.XmlException
public static XmlSaxHandler newXmlSaxHandler()
XmlSaxHandler
that can load an XmlObject from SAX events.public static XmlSaxHandler newXmlSaxHandler(XmlOptions options)
XmlSaxHandler
that can load an XmlObject from SAX events.public static DOMImplementation newDomImplementation()
public static DOMImplementation newDomImplementation(XmlOptions options)