Skip to content

Latest commit

 

History

History
251 lines (207 loc) · 50.4 KB

File metadata and controls

251 lines (207 loc) · 50.4 KB

This service allows scripts to parse, navigate, and programmatically create XML documents.

Class: Attribute

A representation of an XML attribute.

Method Description Return Type Return Description Status Implementation
getName() Gets the local name of the attribute. If the attribute has a namespace prefix, use getNamespace().getPrefix() to get the prefix. String The local name of the attribute. completed link
getNamespace() Gets the namespace for the attribute. Namespace|null The namespace for the attribute. completed link
getValue() Gets the value of the attribute. String The value of the attribute. completed link
setName(String) Sets the local name of the attribute. To set a namespace prefix for the attribute, use setNamespace(namespace) in conjunction with XmlService.getNamespace(prefix, uri). Attribute The attribute, for chaining. completed link
setNamespace(Namespace) Sets the namespace for the attribute. The namespace must have a prefix. Attribute The attribute, for chaining. completed link
setValue(String) Sets the value of the attribute. Attribute The attribute, for chaining. completed link

Class: Cdata

A representation of an XML CDATASection node.

Method Description Return Type Return Description Status Implementation
append(String) Appends the given text to any content that already exists in the node. Text The Text node, for chaining. completed link
detach() Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect. Content|null The detached node. completed link
getParentElement() Gets the node's parent Element node. If the node does not have a parent, this method returns null. Element|null The parent Element node. completed link
getText() Gets the text value of the Text node. String The text value of the Text node. completed link
getValue() Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. String The text value of all nodes that are direct or indirect children of the node. completed link
setText(String) Sets the text value of the Text node. Text The Text node, for chaining. completed link

Class: Comment

A representation of an XML Comment node.

Method Description Return Type Return Description Status Implementation
detach() Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect. Content|null The detached node. completed link
getParentElement() Gets the node's parent Element node. If the node does not have a parent, this method returns null. Element|null The parent Element node. completed link
getText() Gets the text value of the Comment node. String The text value of the Comment node. completed link
getValue() Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. String The text value of all nodes that are direct or indirect children of the node. completed link
setText(String) Sets the text value of the Comment node. Comment The Comment node, for chaining. completed link

Class: DocType

A representation of an XML DocumentType node.

Method Description Return Type Return Description Status Implementation
detach() Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect. Content|null The detached node. completed link
getElementName() Gets the name of the root Element node specified in the DocType declaration. String The name of the root Element node specified in the DocType declaration. completed link
getInternalSubset() Gets the internal subset data for the DocumentType node. String The internal subset data. completed link
getParentElement() Gets the node's parent Element node. If the node does not have a parent, this method returns null. Element|null The parent Element node. completed link
getPublicId() Gets the public ID of the external subset data for the DocumentType node. String The public ID of the external subset data. completed link
getSystemId() Gets the system ID of the external subset data for the DocumentType node. String The system ID of the external subset data. completed link
getValue() Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. String The text value of all nodes that are direct or indirect children of the node. completed link
setElementName(String) Sets the name of the root Element node to specify in the DocType declaration. DocType The DocumentType node, for chaining. completed link
setInternalSubset(String) Sets the internal subset data for the DocumentType node. DocType The DocumentType node, for chaining. completed link
setPublicId(String) Sets the public ID of the external subset data for the DocumentType node. DocType The DocumentType node, for chaining. completed link
setSystemId(String) Sets the system ID of the external subset data for the DocumentType node. DocType The DocumentType node, for chaining. completed link

Class: Document

A representation of an XML document.

Method Description Return Type Return Description Status Implementation
addContent(Content) Appends the given node to the end of the document. The content argument can be a Content object or any node object that corresponds to a type listed in ContentType. Note, however, that a document can only have one child Element node, which is implicitly the root Element node. Document The document, for chaining. completed link
addContent(Integer,Content) completed link
cloneContent() Creates unattached copies of all nodes that are immediate children of the document. Content[] An array of unattached copies of all nodes that are immediate children of the document. completed link
detachRootElement() Detaches and returns the document's root Element node. If the document does not have a root Element node, this method returns null. Element|null The detached Element node, or null if the document does not have a root Element node. completed link
getAllContent() Gets all nodes that are immediate children of the document. Content[] An array of all nodes that are immediate children of the document. completed link
getContent(Integer) Gets the node at the given index among all nodes that are immediate children of the document. If there is no node at the given index, this method returns null. Content|null The node, or null if there is no node at the given index. completed link
getContentSize() Gets the number of nodes that are immediate children of the document. Integer The number of nodes that are immediate children of the document. completed link
getDescendants() Gets all nodes that are direct or indirect children of the document, in the order they appear in the document. Content[] An array of all nodes that are direct or indirect children of the document. completed link
getDocType() Gets the document's DocType declaration. If the document does not have a DocumentType node, this method returns null. DocType|null The DocumentType node, or null if the document does not have a DocumentType node. completed link
getRootElement() Gets the document's root Element node. If the document does not have a root Element node, this method returns null. Element|null The root Element node, or null if the document does not have a root Element node. completed link
hasRootElement() Determines whether the document has a root Element node. Boolean true if the document has a root Element node; false if not. completed link
removeContent() Removes all nodes that are immediate children of the document. Content[] An array of all nodes that were immediate children of the document before they were removed. completed link
removeContent(Content) Removes the given node, if the node is an immediate child of the document. The content argument can be a Content object or any node object that corresponds to a type listed in ContentType. Boolean true if the node was an immediate child and was removed; false if not. completed link
removeContent(Integer) Removes the node at the given index among all nodes that are immediate children of the document. If there is no node at the given index, this method returns null. Content|null The node that was removed, or null if there is no node at the given index. completed link
setDocType(DocType) Sets the document's DocType declaration. If the document already has a different DocType node, this method overwrites the old node. This method throws an exception if the document already contains the same DocType node that is being set. Document The document, for chaining. completed link
setRootElement(Element) Sets the document's root Element node. If the document already has a root Element node, this method overwrites the old node. Document The document, for chaining. completed link

Class: Element

A representation of an XML Element node.

Method Description Return Type Return Description Status Implementation
addContent(Content) Appends the given node as the last child of the Element node. The content argument can be a Element object or any node object that corresponds to a type listed in ContentType. Element The Element node, for chaining. completed link
addContent(Integer,Content) completed link
cloneContent() Creates unattached copies of all nodes that are immediate children of the {@code Element} node. Content[] An array of unattached copies of all nodes that are immediate children of the {@code Element} node. completed link
detach() Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect. Content|null The detached node. completed link
getAllContent() Gets all nodes that are immediate children of the {@code Element} node. Content[] An array of all nodes that are immediate children of the {@code Element} node. completed link
getAttribute(String,Namespace) completed link
getAttribute(String) Gets the attribute for this Element node with the given name and no namespace. If there is no such attribute, this method returns null. Attribute|null The attribute, or null if there is no attribute with the given name and no namespace. completed link
getAttributes() Gets all attributes for this Element node, in the order they appear in the document. Attribute[] An array of all attributes for this Element node. completed link
getChild(String,Namespace) completed link
getChild(String) Gets the first Element node with the given name and no namespace that is an immediate child of this Element node. If there is no such node, this method returns null. Element|null The Element node, or null if there is no immediate child Element node with the given name and no namespace. completed link
getChildren() Gets all Element nodes that are immediate children of this Element node, in the order they appear in the document. Element[] An array of all Element nodes that are immediate children of this Element node. completed link
getChildren(String,Namespace) completed link
getChildren(String) Gets all Element nodes with the given name and no namespace that are immediate children of this Element node, in the order they appear in the document. Element[] An array of all Element nodes with the given name and no namespace that are immediate children of this Element node. completed link
getChildText(String,Namespace) completed link
getChildText(String) Gets the text value of the node with the given name and no namespace, if the node is an immediate child of the Element node. If there is no such node, this method returns null. String|null The text value of the child node, or null if there is no immediate child node with the given name and no namespace. completed link
getContent(Integer) Gets the node at the given index among all nodes that are immediate children of the {@code Element} node. If there is no node at the given index, this method returns null. Content|null The node, or null if there is no node at the given index. completed link
getContentSize() Gets the number of nodes that are immediate children of the {@code Element} node. Integer The number of nodes that are immediate children of the {@code Element} node. completed link
getDescendants() Gets all nodes that are direct or indirect children of the {@code Element} node, in the order they appear in the document. Content[] An array of all nodes that are direct or indirect children of the {@code Element} node. completed link
getDocument() Gets the XML document that contains the {@code Element} node. Document The document that contains the {@code Element} node. completed link
getName() Gets the local name of the Element node. If the node has a namespace prefix, use getQualifiedName() or getNamespace().getPrefix() to get the prefix. String The local name of the Element node. completed link
getNamespace() Gets the namespace for the Element node. Namespace The namespace for the Element node. completed link
getNamespace(String) Gets the namespace with the given prefix for the Element node. Namespace The namespace with the given prefix for the Element node. completed link
getParentElement() Gets the node's parent Element node. If the node does not have a parent, this method returns null. Element|null The parent Element node. completed link
getQualifiedName() Gets the local name and namespace prefix of the Element node, in the form [namespacePrefix]:[localName]. If the node does not have a namespace prefix, use getName(). String The local name and namespace prefix of the Element node, in the form [namespacePrefix]:[localName]. completed link
getText() Gets the text value of the Element node. String The text value of the Element node. completed link
getValue() Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. String The text value of all nodes that are direct or indirect children of the node. completed link
isAncestorOf(Element) Determines whether this Element node is a direct or indirect parent of a given Element node. Boolean true if this Element node is a direct or indirect parent of the given Element node; false if not. completed link
isRootElement() Determines whether the Element node is the document's root node. Boolean true if the Element node is the document's root node; false if not. completed link
removeAttribute(Attribute) Removes the given attribute for this Element node, if such an attribute exists. Boolean true if the attribute existed and was removed; false if not. completed link
removeAttribute(String,Namespace) completed link
removeAttribute(String) Removes the attribute for this Element node with the given name and no namespace, if such an attribute exists. Boolean true if the attribute existed and was removed; false if not. completed link
removeContent() Removes all nodes that are immediate children of the {@code Element} node. Content[] An array of all nodes that were immediate children of the {@code Element} node before they were removed. completed link
removeContent(Content) Removes the given node, if the node is an immediate child of the {@code Element} node. The content argument can be a Element object or any node object that corresponds to a type listed in ContentType. Boolean true if the node was an immediate child and was removed; false if not. completed link
removeContent(Integer) Removes the node at the given index among all nodes that are immediate children of the {@code Element} node. If there is no node at the given index, this method returns null. Content|null The node that was removed, or null if there is no node at the given index. completed link
setAttribute(Attribute) Sets the given attribute for this Element node. Element The Element node, for chaining. completed link
setAttribute(String,String,Namespace) completed link
setAttribute(String,String) completed link
setName(String) Sets the local name of the Element node. To set a namespace prefix for the node, use setNamespace(namespace) in conjunction with XmlService.getNamespace(prefix, uri). Element The Element node, for chaining. completed link
setNamespace(Namespace) Sets the namespace for the Element node. Element The Element node, for chaining. completed link
setText(String) Sets the text value of the Element node. If the node already contains a text value or any child nodes, this method overwrites the old content. To append or insert content instead, use addContent(content) or addContent(index, content). Element The Element node, for chaining. completed link

Class: EntityRef

A representation of an XML EntityReference node.

Method Description Return Type Return Description Status Implementation
detach() Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect. Content|null The detached node. completed link
getName() Gets the name of the EntityReference node. String The name of the EntityReference node. completed link
getParentElement() Gets the node's parent Element node. If the node does not have a parent, this method returns null. Element|null The parent Element node. completed link
getPublicId() Gets the public ID of the EntityReference node. If the node does not have a public ID, this method returns null. String|null The public ID of the EntityReference node, or null if it has none. completed link
getSystemId() Gets the system ID of the EntityReference node. If the node does not have a system ID, this method returns null. String|null The system ID of the EntityReference node, or null if it has none. completed link
getValue() Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. String The text value of all nodes that are direct or indirect children of the node. completed link
setName(String) Sets the name of the EntityReference node. EntityRef The EntityReference node, for chaining. completed link
setPublicId(String) Sets the public ID of the EntityReference node. EntityRef The EntityReference node, for chaining. completed link
setSystemId(String) Sets the system ID of the EntityReference node. EntityRef The EntityReference node, for chaining. completed link

Class: Format

A formatter for outputting an XML document, with three pre-defined formats that can be further customized.

Method Description Return Type Return Description Status Implementation
format(Document) Outputs the given Document as a formatted string. String The formatted document. completed link
format(Element) Outputs the given Element node as a formatted string. String The formatted element. completed link
setEncoding(String) Sets the character encoding that the formatter should use. The encoding argument must be an accepted XML encoding like ISO-8859-1, US-ASCII, UTF-8, or UTF-16. Format The formatter, for chaining. completed link
setIndent(String) Sets the string used to indent child nodes relative to their parents. Setting an indent other than null will cause the formatter to insert a line break after every node. Format The formatter, for chaining. completed link
setLineSeparator(String) Sets the string to insert whenever the formatter would normally insert a line break. The three pre-defined formatters have different conditions under which they insert a line break. The default line separator is \r\n. Format The formatter, for chaining. completed link
setOmitDeclaration(Boolean) Sets whether the formatter should omit the XML declaration, such as . Format The formatter, for chaining. completed link
setOmitEncoding(Boolean) Sets whether the formatter should omit the encoding in the XML declaration, such as the encoding field in . Format The formatter, for chaining. completed link

Class: Namespace

A representation of an XML namespace.

Method Description Return Type Return Description Status Implementation
getPrefix() Gets the prefix for the namespace. String The prefix for the namespace. completed link
getURI() Gets the URI for the namespace. String The URI for the namespace. completed link

A representation of an XML ProcessingInstruction node.

Method Description Return Type Return Description Status Implementation
detach() Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect. Content|null The detached node. completed link
getData() Gets the raw data for every instruction in the ProcessingInstruction node. String The raw data for every instruction in the ProcessingInstruction node. completed link
getParentElement() Gets the node's parent Element node. If the node does not have a parent, this method returns null. Element|null The parent Element node. completed link
getTarget() Gets the target for the ProcessingInstruction node. String The target for the ProcessingInstruction node. completed link
getValue() Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. String The text value of all nodes that are direct or indirect children of the node. completed link

Class: Text

A representation of an XML Text node.

Method Description Return Type Return Description Status Implementation
append(String) Appends the given text to any content that already exists in the node. Text The Text node, for chaining. completed link
detach() Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect. Content|null The detached node. completed link
getParentElement() Gets the node's parent Element node. If the node does not have a parent, this method returns null. Element|null The parent Element node. completed link
getText() Gets the text value of the Text node. String The text value of the Text node. completed link
getValue() Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. String The text value of all nodes that are direct or indirect children of the node. completed link
setText(String) Sets the text value of the Text node. Text The Text node, for chaining. completed link

Class: XmlService

This service allows scripts to parse, navigate, and programmatically create XML documents.

Method Description Return Type Return Description Status Implementation
createCdata(String) Creates an unattached CDATASection node with the given value. Cdata The newly created CDATASection node. completed link
createComment(String) Creates an unattached Comment node with the given value. Comment The newly created Comment node. completed link
createDocType(String,String,String) completed link
createDocType(String,String) completed link
createDocType(String) Creates an unattached DocumentType node for the root Element node with the given name. DocType The newly created DocumentType node. completed link
createDocument() Creates an empty XML document. Document The newly created document. completed link
createDocument(Element) Creates an XML document with the given root Element node. Document The newly created document. completed link
createElement(String,Namespace) completed link
createElement(String) Creates an unattached Element node with the given local name and no namespace. Element The newly created Element node. completed link
createText(String) Creates an unattached Text node with the given value. Text The newly created Text node. completed link
getCompactFormat() Creates a Format object for outputting a compact XML document. The formatter defaults to UTF-8 encoding, no indentation, and no additional line breaks, but includes the XML declaration and its encoding. Format The newly created formatter. completed link
getNamespace(String,String) completed link
getNamespace(String) Creates a Namespace with the given URI. Namespace The newly created namespace. completed link
getNoNamespace() Creates a Namespace that represents the absence of a real namespace. Namespace The newly created namespace. completed link
getPrettyFormat() Creates a Format object for outputting a human-readable XML document. The formatter defaults to UTF-8 encoding, two-space indentation, \r\n line separators after every node, and includes the XML declaration and its encoding. Format The newly created formatter. completed link
getRawFormat() Creates a Format object for outputting a raw XML document. The formatter defaults to UTF-8 encoding, no indentation and no line breaks other than those provided in the XML document itself, and includes the XML declaration and its encoding. Format The newly created formatter. completed link
getXmlNamespace() Creates a Namespace with the standard xml prefix. Namespace The newly created namespace. completed link
parse(String) Creates an Document from the given XML, without validating the XML. Document The newly created document. completed link

An enumeration representing the types of XML content nodes.

Property Description Status Implementation
CDATA An XML CDATASection node. not started
COMMENT An XML Comment node. not started
DOCTYPE An XML DocumentType node. not started
ELEMENT An XML Element node. not started
ENTITYREF An XML EntityReference node. not started
PROCESSINGINSTRUCTION An XML ProcessingInstruction node. not started
TEXT An XML Text node. not started

Interface: Content

A representation of a generic XML node.

Property Description Status Implementation
asCdata() Casts the node as a CDATASection node for the purposes of autocomplete. If the node's ContentType is not already CDATA, this method returns null. completed link
asComment() Casts the node as a Comment node for the purposes of autocomplete. If the node's ContentType is not already COMMENT, this method returns null. completed link
asDocType() Casts the node as a DocumentType node for the purposes of autocomplete. If the node's ContentType is not already DOCTYPE, this method returns null. completed link
asElement() Casts the node as an Element node for the purposes of autocomplete. If the node's ContentType is not already ELEMENT, this method returns null. completed link
asEntityRef() Casts the node as a EntityReference node for the purposes of autocomplete. If the node's ContentType is not already ENTITYREF, this method returns null. completed link
asProcessingInstruction() Casts the node as a ProcessingInstruction node for the purposes of autocomplete. If the node's ContentType is not already PROCESSINGINSTRUCTION, this method returns null. completed link
asText() Casts the node as a Text node for the purposes of autocomplete. If the node's ContentType is not already TEXT, this method returns null. completed link
detach() Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect. completed link
getParentElement() Gets the node's parent Element node. If the node does not have a parent, this method returns null. completed link
getType() Gets the node's content type. completed link
getValue() Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document. completed link