public class OMDocument extends OMNode
| Modifier | Constructor and Description |
|---|---|
protected |
OMDocument(com.google.gwt.dom.client.Document document)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
OMElement |
createElementNS(String namespaceURI,
String qualifiedName)
Creates an
OMElement of the given qualified name and namespace URI. |
OMText |
createTextNode(String data)
Creates a new
OMText node and initializes it
with the specified data. |
com.google.gwt.dom.client.Document |
getDocument()
Returns the wrapped
Document |
OMElement |
getDocumentElement()
This is a convenience attribute that allows direct access to the child
node that is the document element of the document.
|
<T extends OMElement> |
getElementById(String elementId)
Returns the
OMElement that has an ID attribute with the
given value. |
<T extends OMElement> |
getElementsByTagName(String tagname)
Returns a
OMNodeList of all the OMElements in
document order with a given tag name and are contained in the
document. |
<T extends OMElement> |
getElementsByTagNameNS(String namespaceURI,
String localName)
Returns a
OMNodeList of all the OMElements with a
given local name and namespace URI in document order. |
OMNode |
importNode(OMNode importedNode,
boolean deep)
Imports a node from another document to this document, without altering
or removing the source node from the original document; this method
creates a new copy of the source node.
|
addDomHandler, addHandler, appendChild, cleanup, cloneNode, convert, convertList, dispatch, fireEvent, getChildNodes, getEventBus, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNode, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasChildNodes, insertBefore, normalize, removeChild, replaceChild, setNodeValue, toStringprotected OMDocument(com.google.gwt.dom.client.Document document)
document - The wrapped documentpublic com.google.gwt.dom.client.Document getDocument()
DocumentDocumentpublic final OMElement createElementNS(String namespaceURI, String qualifiedName) throws com.google.gwt.core.client.JavaScriptException
OMElement of the given qualified name and namespace URI.
null as the
namespaceURI parameter for methods if they wish to have no namespace.namespaceURI - The namespace URI of the element to create.qualifiedName - The qualified name of the element type to
instantiate.OMElement object with the following
attributes:
| Attribute | Value |
|---|---|
Node.nodeName |
qualifiedName |
Node.namespaceURI |
namespaceURI |
Node.prefix |
prefix, extracted
from qualifiedName, or null if there is
no prefix |
Node.localName |
local name, extracted from
qualifiedName |
Element.tagName |
qualifiedName |
DOMException - INVALID_CHARACTER_ERR: Raised if the specified
qualifiedName is not an XML name according to the XML
version in use specified in the Document.xmlVersion
attribute.
qualifiedName is a
malformed qualified name, if the qualifiedName has a
prefix and the namespaceURI is null, or
if the qualifiedName has a prefix that is "xml" and
the namespaceURI is different from "
http://www.w3.org/XML/1998/namespace" [XML Namespaces]
, or if the qualifiedName or its prefix is "xmlns" and
the namespaceURI is different from "http://www.w3.org/2000/xmlns/", or if the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName nor its prefix is "xmlns".
"XML" feature, since namespaces were
defined by XML.com.google.gwt.core.client.JavaScriptExceptionpublic final OMText createTextNode(String data)
OMText node and initializes it
with the specified data. The node is not attached to the
DOM tree.data - The string to initialize the text nodeOMText nodepublic final <T extends OMElement> OMNodeList<T> getElementsByTagName(String tagname)
OMNodeList of all the OMElements in
document order with a given tag name and are contained in the
document.tagname - The name of the tag to match on. The special value "*"
matches all tags. For XML, the tagname parameter is
case-sensitive, otherwise it depends on the case-sensitivity of the
markup language in use.OMNodeList object containing all the matched
Elements.public final <T extends OMElement> OMNodeList<T> getElementsByTagNameNS(String namespaceURI, String localName)
OMNodeList of all the OMElements with a
given local name and namespace URI in document order.namespaceURI - The namespace URI of the elements to match on. The
special value "*" matches all namespaces.localName - The local name of the elements to match on. The
special value "*" matches all local names.OMNodeList object containing all the matched
Elements.public final <T extends OMElement> T getElementById(String elementId)
OMElement that has an ID attribute with the
given value. If no such element exists, this returns null
. If more than one element has an ID attribute with that value, what
is returned is undefined.
Attr.isId to determine if an attribute is of type ID.
Note: Attributes with the name "ID" or "id" are not of type ID unless so defined.
elementId - The unique id value for an element.null if there is none.public final OMElement getDocumentElement()
public final OMNode importNode(OMNode importedNode, boolean deep)
parentNode is null).
nodeName and nodeType, plus the
attributes related to namespaces (prefix,
localName, and namespaceURI). As in the
cloneNode operation, the source node is not altered.
User data associated to the imported node is not carried over.
However, if any UserDataHandlers has been specified
along with the associated data these handlers will be called with the
appropriate parameters before this method returns.
nodeType, attempting to mirror the behavior expected if
a fragment of XML or HTML source was copied from one document to
another, recognizing that the two documents may have different DTDs
in the XML case. The following list describes the specifics for each
type of node.
ownerElement attribute
is set to null and the specified flag is
set to true on the generated OMAttr. The
descendants of the source OMAttr are recursively imported
and the resulting nodes reassembled to form the corresponding subtree.
Note that the deep parameter has no effect on
OMAttr nodes; they always carry their children with them
when imported.deep option
was set to true, the descendants of the source
DocumentFragment are recursively imported and the
resulting nodes reassembled under the imported
DocumentFragment to form the corresponding subtree.
Otherwise, this simply generates an empty
DocumentFragment.Document
nodes cannot be imported.DocumentType
nodes cannot be imported.OMAttr nodes are attached to the generated
OMElement. Default attributes are not copied, though if the document being imported into defines default
attributes for this element name, those are assigned. If the
importNode deep parameter was set to
true, the descendants of the source element are
recursively imported and the resulting nodes reassembled to form the
corresponding subtree.Entity nodes can be
imported, however in the current release of the DOM the
DocumentType is readonly. Ability to add these imported
nodes to a DocumentType will be considered for addition
to a future release of the DOM.On import, the publicId,
systemId, and notationName attributes are
copied. If a deep import is requested, the descendants
of the the source Entity are recursively imported and
the resulting nodes reassembled to form the corresponding subtree.EntityReference itself is
copied, even if a deep import is requested, since the
source and destination documents might have defined the entity
differently. If the document being imported into provides a
definition for this entity name, its value is assigned.Notation nodes can be imported, however in the current
release of the DOM the DocumentType is readonly. Ability
to add these imported nodes to a DocumentType will be
considered for addition to a future release of the DOM.On import, the
publicId and systemId attributes are copied.
Note that the deep parameter has no effect on this type
of nodes since they cannot have any children.target and data values from those of the
source node.Note that the deep parameter has no effect
on this type of nodes since they cannot have any children.CharacterData copy their data and
length attributes from those of the source node.Note
that the deep parameter has no effect on these types of
nodes since they cannot have any children.importedNode - The node to import.deep - If true, recursively import the subtree under
the specified node; if false, import only the node
itself, as explained above. This has no effect on nodes that cannot
have any children, and on OMAttr, and
EntityReference nodes.Document.DOMException - NOT_SUPPORTED_ERR: Raised if the type of node being imported is not
supported.
Document.xmlVersion attribute. This may happen when
importing an XML 1.1 [XML 1.1] element
into an XML 1.0 document, for instance.Copyright © 2018. All Rights Reserved.