public class XmlDocument
extends java.lang.Object
Represents an XML document.
| Constructor and Description |
|---|
XmlDocument() |
| Modifier and Type | Method and Description |
|---|---|
void |
appendTo(com.sap.cloud.server.odata.core.CharBuffer buffer)
|
void |
appendTo(com.sap.cloud.server.odata.core.CharBuffer buffer,
int indent)
Append the textual representation of this document to a buffer.
|
java.lang.String |
getDeclaration()
Return (nullable) The XML declaration, or
null. |
XmlProcessingInstructionList |
getProcessingInstructions()
Return the XML processing instructions (if any).
|
XmlElement |
getRootElement()
Return the document root element.
|
boolean |
getWasDecompressed()
Return was this document parsed from a compressed XML?
|
static XmlDocument |
parse(java.lang.String xml)
Parse a string to a document.
|
static XmlDocument |
parseMixed(java.lang.String xml,
boolean mixed)
Parse a string to a document.
|
void |
resolveNamespaces()
Traverse the element hierachy starting at the
XmlDocument.rootElement, ensuring that
every node has the XmlElement.namespaceURI set according to the "xmlns"
attributes and namespace prefixes encountered in the nodes. |
void |
setDeclaration(java.lang.String value)
Set the XML declaration, or
null. |
void |
setProcessingInstructions(XmlProcessingInstructionList value)
Set the XML processing instructions (if any).
|
void |
setRootElement(XmlElement value)
Set the document root element.
|
void |
setWasDecompressed(boolean value)
Set was this document parsed from a compressed XML?
|
java.lang.String |
toString()
Return the root element, preceeded by an XML declaration and processing instructions (if any).
|
public void appendTo(com.sap.cloud.server.odata.core.CharBuffer buffer)
buffer - Buffer parameter.public void appendTo(com.sap.cloud.server.odata.core.CharBuffer buffer,
int indent)
Append the textual representation of this document to a buffer.
buffer - Buffer to receive textual representation.indent - Indent level for indented pretty-printing. Use -1 to disable pretty-printing.public java.lang.String getDeclaration()
Return (nullable) The XML declaration, or null.
null.public XmlProcessingInstructionList getProcessingInstructions()
Return the XML processing instructions (if any).
public XmlElement getRootElement()
Return the document root element.
public boolean getWasDecompressed()
Return was this document parsed from a compressed XML?
public static XmlDocument parse(java.lang.String xml)
Parse a string to a document. Equivalent to parseMixed(xml, false).
xml - Text to be parsed.public static XmlDocument parseMixed(java.lang.String xml, boolean mixed)
Parse a string to a document.
xml - Text to be parsed.mixed - true if mixed content is permitted, false otherwise. Parsing may be faster with mixed = false, since text nodes can be omitted from elements which have non-text content.public void resolveNamespaces()
Traverse the element hierachy starting at the XmlDocument.rootElement, ensuring that
every node has the XmlElement.namespaceURI set according to the "xmlns"
attributes and namespace prefixes encountered in the nodes.
public void setDeclaration(java.lang.String value)
Set the XML declaration, or null.
value - The XML declaration, or null.public void setProcessingInstructions(XmlProcessingInstructionList value)
Set the XML processing instructions (if any).
value - The XML processing instructions (if any).public void setRootElement(XmlElement value)
Set the document root element.
value - The document root element.public void setWasDecompressed(boolean value)
Set was this document parsed from a compressed XML?
value - Was this document parsed from a compressed XML?public java.lang.String toString()
Return the root element, preceeded by an XML declaration and processing instructions (if any).
toString in class java.lang.Object