|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.caucho.xml.QAbstractNode | +--com.caucho.xml.QNode | +--com.caucho.xml.QDocumentFragment | +--com.caucho.xml.QDocument
Implements the top-level document for the XML tree.
Field Summary | |
protected Document |
masterDoc
|
Fields inherited from class com.caucho.xml.QAbstractNode |
L |
Fields inherited from interface com.caucho.xml.CauchoDocument |
DEPENDS |
Fields inherited from interface org.w3c.dom.Node |
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
Constructor Summary | |
QDocument()
|
Method Summary | |
void |
addDepend(Path path)
|
void |
addNamespace(java.lang.String prefix,
java.lang.String url)
Add a namespace declaration to a document. |
Node |
appendChild(Node newChild)
Adds the node newChild to the end of the list of children
of this node. |
Node |
cloneNode(boolean deep)
Returns a clone of the document. |
protected Node |
copyNode(QDocument newNode,
boolean deep)
|
static Document |
create()
|
Attr |
createAttribute(QName name,
java.lang.String value)
Creates a new namespace-aware attribute |
Attr |
createAttribute(java.lang.String name)
Creates an Attr of the given name. |
Attr |
createAttribute(java.lang.String name,
java.lang.String value)
|
Attr |
createAttribute(java.lang.String prefix,
java.lang.String local,
java.lang.String url)
Creates a new namespace-aware attribute |
Attr |
createAttributeNS(java.lang.String uri,
java.lang.String qname)
Creates a new namespace-aware attribute |
CDATASection |
createCDATASection(java.lang.String data)
Creates a CDATASection node whose value is the specified
string. |
Comment |
createComment(java.lang.String data)
Creates a Comment node given the specified string. |
DocumentFragment |
createDocumentFragment()
Creates a new document fragment. |
Element |
createElement(java.lang.String tagName)
Creates a new element |
Element |
createElement(java.lang.String prefix,
java.lang.String local,
java.lang.String url)
Creates a new namespace-aware element |
Element |
createElementByName(QName name)
Creates a new namespace-aware element |
Element |
createElementNS(java.lang.String namespaceURI,
java.lang.String name)
Creates a new namespace-aware element |
EntityReference |
createEntityReference(java.lang.String name)
Creates an EntityReference object. |
QName |
createName(java.lang.String uri,
java.lang.String name)
|
ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.lang.String data)
Creates a ProcessingInstruction node given the specified
name and data strings. |
Text |
createTextNode(java.lang.String data)
Creates a new text node in this document. |
Text |
createUnescapedTextNode(java.lang.String data)
|
DocumentType |
getDoctype()
The Document Type Declaration (see DocumentType )
associated with this document. |
Element |
getDocumentElement()
This is a convenience attribute that allows direct access to the child node that is the root element of the document. |
Element |
getElementById(java.lang.String name)
Returns the Element whose ID is given by
elementId . |
NodeList |
getElementsByTagName(java.lang.String name)
Returns a list of elements, filtered by the tag name. |
NodeList |
getElementsByTagNameNS(java.lang.String uri,
java.lang.String name)
Returns a NodeList of all the Elements with a
given local name and namespace URI in the order in which they are
encountered in a preorder traversal of the Document tree. |
java.lang.String |
getEncoding()
|
DOMImplementation |
getImplementation()
The DOMImplementation object that handles this document. |
Document |
getMasterDoc()
|
java.lang.String |
getNamespace(java.lang.String prefix)
Returns the namespace url for a given prefix. |
java.util.Iterator |
getNamespaceKeys()
Returns an iterator of top-level namespace prefixes. |
java.util.HashMap |
getNamespaces()
|
java.lang.String |
getNodeName()
The node name for the document is #document. |
short |
getNodeType()
A code representing the type of the underlying object, as defined above. |
Document |
getOwnerDocument()
The Document object associated with this node. |
java.lang.Object |
getProperty(java.lang.String name)
|
java.lang.String |
getRootFilename()
|
java.lang.String |
getTextValue()
Returns the text value of the node |
Node |
importNode(Node node,
boolean deep)
Imports a copy of a node into the current document. |
boolean |
isSupported(java.lang.String feature,
java.lang.String version)
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node. |
Node |
removeChild(Node oldChild)
Removes the child node indicated by oldChild from the list
of children, and returns it. |
void |
setDoctype(DocumentType dtd)
|
void |
setDocumentElement(Element elt)
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
|
void |
setRootFilename(java.lang.String filename)
|
java.lang.String |
toString()
|
Methods inherited from class com.caucho.xml.QNode |
checkValid, equals, equals, getAttributes, getChildNodes, getFirstChild, getLastChild, getLength, getNextPreorder, getNextSibling, getNodeValue, getPreviousSibling, hasChildNodes, insertBefore, item, normalize, replaceChild, setNodeValue |
Methods inherited from class com.caucho.xml.QAbstractNode |
getCanonicalName, getColumn, getFilename, getLine, getLocalName, getNamespaceURI, getNextContent, getParentNode, getPrefix, getPreviousContent, hasAttributes, hasContent, print, printHtml, printPretty, setLocation, setPrefix, supports |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.w3c.dom.Node |
getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, normalize, replaceChild, setNodeValue, setPrefix |
Methods inherited from interface com.caucho.xml.CauchoNode |
checkValid, getCanonicalName, getColumn, getFilename, getLine, getLocalName, getNamespaceURI, getPrefix, getTextValue, print, printHtml, printPretty, setLocation |
Field Detail |
protected Document masterDoc
Constructor Detail |
public QDocument()
Method Detail |
public java.lang.String getRootFilename()
public void setRootFilename(java.lang.String filename)
public Document getOwnerDocument()
Node
Document
object associated with this node. This is
also the Document
object used to create new nodes. When
this node is a Document
or a DocumentType
which is not used with any Document
yet, this is
null
.getOwnerDocument
in interface Node
getOwnerDocument
in class QAbstractNode
public boolean isSupported(java.lang.String feature, java.lang.String version)
Node
isSupported
in interface Node
isSupported
in class QAbstractNode
org.w3c.dom.Node
feature
- The name of the feature to test. This is the same name
which can be passed to the method hasFeature
on
DOMImplementation
.version
- This is the version number of the feature to test. In
Level 2, version 1, this is the string "2.0". If the version is not
specified, supporting any version of the feature will cause the
method to return true
.true
if the specified feature is
supported on this node, false
otherwise.public java.lang.String getNodeName()
getNodeName
in interface Node
getNodeName
in class com.caucho.xml.QDocumentFragment
public short getNodeType()
Node
getNodeType
in interface Node
getNodeType
in class com.caucho.xml.QDocumentFragment
protected Node copyNode(QDocument newNode, boolean deep)
public Node cloneNode(boolean deep)
cloneNode
in interface Node
cloneNode
in class QAbstractNode
deep
- if true, recursively copy the document.public Node importNode(Node node, boolean deep)
importNode
in interface Document
node
- the node to import/copydeep
- if true, recursively copy the children.public DocumentType getDoctype()
Document
DocumentType
)
associated with this document. For HTML documents as well as XML
documents without a document type declaration this returns
null
. The DOM Level 2 does not support editing the
Document Type Declaration. docType
cannot be altered in
any way, including through the use of methods inherited from the
Node
interface, such as insertNode
or
removeNode
.getDoctype
in interface Document
public void setDoctype(DocumentType dtd)
public java.lang.String getEncoding()
public DOMImplementation getImplementation()
Document
DOMImplementation
object that handles this document. A
DOM application may use objects from multiple implementations.getImplementation
in interface Document
public Element getDocumentElement()
Document
getDocumentElement
in interface Document
public void setDocumentElement(Element elt)
public Element createElement(java.lang.String tagName) throws DOMException
createElement
in interface Document
org.w3c.dom.Document
tagName
- The name of the element type to instantiate. For XML,
this is case-sensitive. For HTML, the tagName
parameter may be provided in any case, but it must be mapped to the
canonical uppercase form by the DOM implementation.Element
object with the
nodeName
attribute set to tagName
, and
localName
, prefix
, and
namespaceURI
set to null
.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified name contains an
illegal character.public Element createElementNS(java.lang.String namespaceURI, java.lang.String name) throws DOMException
createElementNS
in interface Document
org.w3c.dom.Document
namespaceURI
- The namespace URI of the element to create.qualifiedName
- The qualified name of the element type to
instantiate.Element
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 qualified name
contains an illegal character, per the XML 1.0 specification .
qualifiedName
is
malformed per the Namespaces in XML specification, 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"
feature, since namespaces were
defined by XML.public Element createElement(java.lang.String prefix, java.lang.String local, java.lang.String url) throws DOMException
createElement
in interface CauchoDocument
public Element createElementByName(QName name) throws DOMException
public DocumentFragment createDocumentFragment()
createDocumentFragment
in interface Document
org.w3c.dom.Document
DocumentFragment
.public Text createTextNode(java.lang.String data)
createTextNode
in interface Document
org.w3c.dom.Document
data
- The data for the node.Text
object.public Text createUnescapedTextNode(java.lang.String data)
createUnescapedTextNode
in interface CauchoDocument
public Comment createComment(java.lang.String data)
Document
Comment
node given the specified string.createComment
in interface Document
org.w3c.dom.Document
data
- The data for the node.Comment
object.public CDATASection createCDATASection(java.lang.String data)
Document
CDATASection
node whose value is the specified
string.createCDATASection
in interface Document
org.w3c.dom.Document
data
- The data for the CDATASection
contents.CDATASection
object.DOMException
- NOT_SUPPORTED_ERR: Raised if this document is an HTML document.public ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data) throws DOMException
Document
ProcessingInstruction
node given the specified
name and data strings.createProcessingInstruction
in interface Document
org.w3c.dom.Document
target
- The target part of the processing instruction.data
- The data for the node.ProcessingInstruction
object.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified target contains an
illegal character.
public Attr createAttribute(java.lang.String name, java.lang.String value) throws DOMException
public Attr createAttribute(java.lang.String name) throws DOMException
Document
Attr
of the given name. Note that the
Attr
instance can then be set on an Element
using the setAttributeNode
method.
createAttributeNS
method.createAttribute
in interface Document
org.w3c.dom.Document
name
- The name of the attribute.Attr
object with the nodeName
attribute set to name
, and localName
,
prefix
, and namespaceURI
set to
null
. The value of the attribute is the empty string.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified name contains an
illegal character.public Attr createAttribute(java.lang.String prefix, java.lang.String local, java.lang.String url) throws DOMException
createAttribute
in interface CauchoDocument
public Attr createAttributeNS(java.lang.String uri, java.lang.String qname) throws DOMException
createAttributeNS
in interface Document
org.w3c.dom.Document
namespaceURI
- The namespace URI of the attribute to create.qualifiedName
- The qualified name of the attribute to
instantiate.Attr
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 |
Attr.name |
qualifiedName |
Node.nodeValue |
the empty string |
DOMException
- INVALID_CHARACTER_ERR: Raised if the specified qualified name
contains an illegal character, per the XML 1.0 specification .
qualifiedName
is
malformed per the Namespaces in XML specification, if the
qualifiedName
has a prefix and the
namespaceURI
is null
, if the
qualifiedName
has a prefix that is "xml" and the
namespaceURI
is different from "
http://www.w3.org/XML/1998/namespace", or if the
qualifiedName
, or its prefix, is "xmlns" and the
namespaceURI
is different from "
http://www.w3.org/2000/xmlns/".
"XML"
feature, since namespaces were
defined by XML.public QName createName(java.lang.String uri, java.lang.String name)
public Attr createAttribute(QName name, java.lang.String value) throws DOMException
public EntityReference createEntityReference(java.lang.String name) throws DOMException
Document
EntityReference
object. In addition, if the
referenced entity is known, the child list of the
EntityReference
node is made the same as that of the
corresponding Entity
node.If any descendant of the
Entity
node has an unbound namespace prefix, the
corresponding descendant of the created EntityReference
node is also unbound; (its namespaceURI
is
null
). The DOM Level 2 does not support any mechanism to
resolve namespace prefixes.createEntityReference
in interface Document
org.w3c.dom.Document
name
- The name of the entity to reference.EntityReference
object.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified name contains an
illegal character.
public NodeList getElementsByTagName(java.lang.String name)
getElementsByTagName
in interface Document
org.w3c.dom.Document
tagname
- The name of the tag to match on. The special value "*"
matches all tags.NodeList
object containing all the matched
Elements
.public NodeList getElementsByTagNameNS(java.lang.String uri, java.lang.String name)
Document
NodeList
of all the Elements
with a
given local name and namespace URI in the order in which they are
encountered in a preorder traversal of the Document
tree.getElementsByTagNameNS
in interface Document
org.w3c.dom.Document
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.NodeList
object containing all the matched
Elements
.public Element getElementById(java.lang.String name)
Document
Element
whose ID
is given by
elementId
. If no such element exists, returns
null
. Behavior is not defined if more than one element
has this ID
. The DOM implementation must have
information that says which attributes are of type ID. Attributes
with the name "ID" are not of type ID unless so defined.
Implementations that do not know whether attributes are of type ID or
not are expected to return null
.getElementById
in interface Document
org.w3c.dom.Document
elementId
- The unique id
value for an element.public static Document create()
public Node appendChild(Node newChild) throws DOMException
Node
newChild
to the end of the list of children
of this node. If the newChild
is already in the tree, it
is first removed.appendChild
in interface Node
appendChild
in class QNode
org.w3c.dom.Node
newChild
- The node to add.If it is a
DocumentFragment
object, the entire contents of the
document fragment are moved into the child list of this nodeDOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
allow children of the type of the newChild
node, or if
the node to append is one of this node's ancestors or this node
itself.
newChild
was created
from a different document than the one that created this node.
public Node removeChild(Node oldChild) throws DOMException
Node
oldChild
from the list
of children, and returns it.removeChild
in interface Node
removeChild
in class QNode
org.w3c.dom.Node
oldChild
- The node being removed.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
oldChild
is not a child of
this node.public void addNamespace(java.lang.String prefix, java.lang.String url)
public java.util.HashMap getNamespaces()
getNamespaces
in interface CauchoDocument
public java.lang.String getNamespace(java.lang.String prefix)
public java.util.Iterator getNamespaceKeys()
public java.lang.Object getProperty(java.lang.String name)
getProperty
in interface CauchoDocument
public void setProperty(java.lang.String name, java.lang.Object value)
setProperty
in interface CauchoDocument
public void addDepend(Path path)
public java.lang.String toString()
toString
in class com.caucho.xml.QDocumentFragment
public Document getMasterDoc()
public java.lang.String getTextValue()
CauchoNode
getTextValue
in class QAbstractNode
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |