|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.crimson.tree.NodeBase org.apache.crimson.tree.ParentNode org.apache.crimson.tree.XmlDocument
This class implements the DOM Document interface, and also provides static factory methods to create document instances. Instances represent the top level of an XML 1.0 document, typically consisting of processing instructions followed by one tree of XML data. These documents may be written out for transfer or storage using a variety of text encodings.
The static factory methods do not offer any customization options. in particular, they do not enforce XML Namespaces when parsing, do not offer customizable element factories, and discard certain information which is not intended to be significant to applications. If your application requires more sophisticated use of DOM, you may need to use SAX directly with an XmlDocumentBuilder.
Note: element factories are deprecated because they are
non-standard. They are only provided in this version for backwards
compatibility. Instances are factories for their subsidiary nodes, but
applications may provide their own element factory to bind element tags
to particular DOM implementation classes (which must subclass
ElementNode). For example, a factory may use a set of classes which
support the HTML DOM methods, or which support methods associated with
XML vocabularies for specialized problem domains as found within
Internet Commerce systems. For example, an element tag
<PurchaseOrder>
could be mapped to a
com.startup.commerce.PurchaseOrder
class. The factory can
also use XML Namespace information, if desired.
Since DOM requires nodes to be owned exclusively by one document, they can't be moved from one document to another using DOM APIs. This class provides an changeNodeOwner functionality which may be used to change the document associated with a node, and with any of its children.
Only the core DOM model is supported here, not the HTML support. Such support basically adds a set of convenience element types, and so can be implemented through element factories and document subclasses.
XmlDocumentBuilder
Nested Class Summary | |
(package private) class |
ParentNode.TagList
|
(package private) class |
ParentNode.TagListNS
|
(package private) static class |
XmlDocument.Catalog
|
(package private) static class |
XmlDocument.DocFragNode
|
(package private) static class |
XmlDocument.EntityRefNode
|
(package private) class |
XmlDocument.ExtWriteContext
|
Field Summary | |
(package private) static MessageCatalog |
catalog
|
(package private) static String |
eol
|
private ElementFactory |
factory
|
private Locale |
locale
|
(package private) int |
mutationCount
|
(package private) XmlDocument |
ownerDocument
|
(package private) boolean |
readonly
|
(package private) boolean |
replaceRootElement
|
private String |
systemId
|
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 | |
XmlDocument()
Constructs an empty document object. |
Method Summary | |
org.w3c.dom.Node |
appendChild(org.w3c.dom.Node n)
DOM: Appends the specified child node to the document. |
void |
changeNodeOwner(org.w3c.dom.Node node)
Changes the "owner document" of the given node, and all child and associated attribute nodes, to be this document. |
(package private) void |
checkChildType(int type)
|
Locale |
chooseLocale(String[] languages)
Chooses a client locale to use for diagnostics, using the first language specified in the list that is supported by this DOM implementation. |
org.w3c.dom.Node |
cloneNode(boolean deep)
DOM: Returns a copy of this document. |
org.w3c.dom.Attr |
createAttribute(String name)
DOM: Returns a valueless attribute node with no default value. |
org.w3c.dom.Attr |
createAttributeNS(String namespaceURI,
String qualifiedName)
DOM2: |
org.w3c.dom.CDATASection |
createCDATASection(String text)
DOM: Returns a CDATA section initialized with the given text. |
org.w3c.dom.Comment |
createComment(String data)
DOM: creates a comment node. |
org.w3c.dom.DocumentFragment |
createDocumentFragment()
DOM: Creates a new document fragment. |
org.w3c.dom.Element |
createElement(String tagName)
DOM: Create a new element, associated with this document, with no children, attributes, or parent, by calling createElementEx. |
ElementEx |
createElementEx(String tagName)
Deprecated. Use the standard method createElement instead |
ElementEx |
createElementEx(String uri,
String tagName)
Deprecated. Use the standard method createElementNS instead |
org.w3c.dom.Element |
createElementNS(String namespaceURI,
String qualifiedName)
DOM2: |
org.w3c.dom.EntityReference |
createEntityReference(String name)
DOM: Creates an entity reference to the named entity. |
org.w3c.dom.ProcessingInstruction |
createProcessingInstruction(String target,
String instructions)
DOM: Returns a Processing Instruction node for the specified processing target, with the given instructions. |
org.w3c.dom.Text |
createTextNode(String text)
DOM: returns a Text node initialized with the given text. |
XmlWriteContext |
createWriteContext(Writer out)
Returns an XML write context set up not to pretty-print, and which knows about the entities defined for this document. |
XmlWriteContext |
createWriteContext(Writer out,
int level)
Returns an XML write context which pretty-prints output starting at a specified indent level, and which knows about the entities defined for this document. |
static XmlDocument |
createXmlDocument(org.xml.sax.InputSource in,
boolean doValidate)
Deprecated. Use JAXP javax.xml.parsers package instead |
static XmlDocument |
createXmlDocument(InputStream in,
boolean doValidate)
Deprecated. Use JAXP javax.xml.parsers package instead |
static XmlDocument |
createXmlDocument(String documentURI)
Deprecated. Use JAXP javax.xml.parsers package instead |
static XmlDocument |
createXmlDocument(String documentURI,
boolean doValidate)
Deprecated. Use JAXP javax.xml.parsers package instead |
org.w3c.dom.NamedNodeMap |
getAttributes()
DOM: returns null. |
org.w3c.dom.NodeList |
getChildNodes()
DOM: Returns an object which permits "live" access to all this node's children. |
org.w3c.dom.DocumentType |
getDoctype()
DOM: returns the document type (DTD) |
org.w3c.dom.Element |
getDocumentElement()
DOM: Returns the content root element. |
org.w3c.dom.Element |
getElementById(String elementId)
Returns the Element whose ID is given by
elementId . |
ElementEx |
getElementExById(String id)
Deprecated. As of DOM level 2, replaced by the method Document.getElementById |
ElementFactory |
getElementFactory()
Deprecated. |
org.w3c.dom.NodeList |
getElementsByTagName(String tagname)
DOM: Returns a "live" list view of the elements below this one which have the specified tag name. |
org.w3c.dom.NodeList |
getElementsByTagNameNS(String namespaceURI,
String localName)
|
org.w3c.dom.Node |
getFirstChild()
DOM: Returns the first child of this node, else null if there are no children. |
org.w3c.dom.DOMImplementation |
getImplementation()
The DOMImplementation object that handles this document. |
int |
getIndexOf(org.w3c.dom.Node maybeChild)
Returns the index of the node in the list of children, such that item() will return that child. |
String |
getInheritedAttribute(String name)
Returns the value of a given attribute, tracing up through ancestors if needed. |
String |
getLanguage()
Returns the language id (value of xml:lang
attribute) applicable to this node, if known. |
org.w3c.dom.Node |
getLastChild()
DOM: Returns the last child of this node, else null if there are no children. |
int |
getLength()
DOM: Returns the number of children |
Locale |
getLocale()
Returns the locale to be used for diagnostic messages. |
String |
getLocalName()
DOM2: returns null. |
(package private) String |
getMessage(String messageId)
|
(package private) String |
getMessage(String messageId,
Object[] parameters)
|
String |
getNamespaceURI()
DOM2: returns null. |
org.w3c.dom.Node |
getNextSibling()
DOM: Returns the node immediately following this node in a breadth first traversal of the tree, or null if there is no such sibling. |
String |
getNodeName()
DOM: Returns the string "#document". |
short |
getNodeType()
DOM: Returns the DOCUMENT_NODE node type constant. |
String |
getNodeValue()
DOM: Returns null; overridden by subclasses as needed. |
org.w3c.dom.Document |
getOwnerDoc()
DOM: returns null. |
org.w3c.dom.Document |
getOwnerDocument()
DOM: Returns the document to which this node belongs. |
(package private) ParentNode |
getParentImpl()
|
org.w3c.dom.Node |
getParentNode()
DOM: Returns the node's parent. |
String |
getPrefix()
DOM2: returns null. |
org.w3c.dom.Node |
getPreviousSibling()
DOM: Returns the node immediately preceding this node in a breadth first traversal of the tree, or null if there is no such sibling. |
String |
getSystemId()
Returns system ID associated with the document, or null if this is unknown. |
boolean |
hasAttributes()
Returns whether this node (if it is an element) has any attributes. |
boolean |
hasChildNodes()
DOM: Returns true if there are children to this node. |
org.w3c.dom.Node |
importNode(org.w3c.dom.Node importedNode,
boolean deep)
|
org.w3c.dom.Node |
insertBefore(org.w3c.dom.Node n,
org.w3c.dom.Node refNode)
DOM: Inserts the specified child node into the document. |
boolean |
isReadonly()
Method to allow easy determination of whether a node is read only. |
boolean |
isSupported(String feature,
String version)
DOM2: |
org.w3c.dom.Node |
item(int i)
DOM: Returns the Nth child, or null |
(package private) static String |
java2std(String encodingName)
|
(package private) TextNode |
newText(char[] buf,
int offset,
int len)
|
void |
normalize()
DOM2: noop. |
(package private) void |
reduceWaste()
|
org.w3c.dom.Node |
removeChild(org.w3c.dom.Node oldChild)
DOM: removes child if present, returning argument. |
int |
removeWhiteSpaces(char[] buf)
|
org.w3c.dom.Node |
replaceChild(org.w3c.dom.Node newChild,
org.w3c.dom.Node refChild)
DOM: Replaces the specified child with the new node, returning the original child or throwing an exception. |
org.w3c.dom.DocumentType |
setDoctype(String dtdPublicId,
String dtdSystemId,
String internalSubset)
Establishes how the document prints its document type. |
void |
setElementFactory(ElementFactory factory)
Deprecated. |
void |
setLocale(Locale locale)
Assigns the locale to be used for diagnostic messages. |
void |
setNodeValue(String value)
DOM: does nothing; overridden by subclasses as needed. |
protected void |
setOwnerDocument(XmlDocument doc)
|
(package private) void |
setParentNode(ParentNode arg,
int index)
|
void |
setPrefix(String prefix)
DOM2: throws DOMException.NAMESPACE_ERR Overridden by subclasses that support namespaces. |
void |
setReadonly(boolean deep)
Sets the node to be readonly; applies recursively to the children of this node if the parameter is true. |
void |
setSystemId(String uri)
Assigns the URI associated with the document, which is its system ID. |
void |
trimToSize()
Called to minimize space utilization. |
void |
write(OutputStream out)
Writes the document in UTF-8 character encoding, as a well formed XML construct. |
void |
write(Writer out)
Writes the document as a well formed XML construct. |
void |
write(Writer out,
String encoding)
Writes the document in the specified encoding, and listing that encoding in the XML declaration. |
void |
writeChildrenXml(XmlWriteContext context)
Writes all the child nodes of the document, following each one with the end-of-line string in use in this environment. |
void |
writeXml(XmlWriteContext context)
Writes the document out using the specified context, using an encoding name derived from the stream in the context where that is possible. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.w3c.dom.Document |
getElementsByTagName, getElementsByTagNameNS |
Methods inherited from interface org.w3c.dom.Node |
getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, isSupported, normalize, removeChild, setNodeValue, setPrefix |
Field Detail |
static String eol
static final MessageCatalog catalog
private Locale locale
private String systemId
private ElementFactory factory
int mutationCount
boolean replaceRootElement
XmlDocument ownerDocument
boolean readonly
Constructor Detail |
public XmlDocument()
Method Detail |
public static XmlDocument createXmlDocument(String documentURI, boolean doValidate) throws IOException, org.xml.sax.SAXException
documentURI
- The URI (normally URL) of the documentdoValidate
- If true, validity errors are treated as fatal
IOException
- as appropriate
org.xml.sax.SAXException
- as appropriate
org.xml.sax.SAXParseException
- (with line number information)
for parsing errors
IllegalStateException
- at least when the parser
is configured incorrectlypublic static XmlDocument createXmlDocument(String documentURI) throws IOException, org.xml.sax.SAXException
documentURI
- The URI (normally URL) of the document
IOException
- as appropriate
org.xml.sax.SAXException
- as appropriate
org.xml.sax.SAXParseException
- (with line number information)
for parsing errors
IllegalStateException
- at least when the parser
is configured incorrectlypublic static XmlDocument createXmlDocument(InputStream in, boolean doValidate) throws IOException, org.xml.sax.SAXException
in
- Holds xml documentdoValidate
- If true, validity errors are treated as fatal
IOException
- as appropriate
org.xml.sax.SAXException
- as appropriate
org.xml.sax.SAXParseException
- (with line number information)
for parsing errors
IllegalStateException
- at least when the parser
is configured incorrectlypublic static XmlDocument createXmlDocument(org.xml.sax.InputSource in, boolean doValidate) throws IOException, org.xml.sax.SAXException
in
- The input source of the documentdoValidate
- If true, validity errors are treated as fatal
IOException
- as appropriate
org.xml.sax.SAXException
- as appropriate
org.xml.sax.SAXParseException
- (with line number information)
for parsing errors
IllegalStateException
- at least when the parser
is configured incorrectlypublic Locale getLocale()
getLocale
in interface DocumentEx
public void setLocale(Locale locale)
setLocale
in interface DocumentEx
chooseLocale(java.lang.String[])
public Locale chooseLocale(String[] languages)
chooseLocale
in interface DocumentEx
languages
- Array of language specifiers, ordered with the most
preferable one at the front. For example, "en-ca" then "fr-ca",
followed by "zh_CN". Both RFC 1766 and Java styles are supported.
MessageCatalog
public void write(OutputStream out) throws IOException
out
- stream on which the document will be written
IOException
public void write(Writer out) throws IOException
Use of UTF-8 (or UTF-16) OutputStreamWriters is strongly encouraged. All other encodings may lose critical data, since the standard Java output writers substitute characters such as the question mark for data which they can't encode in the current output encoding. The IETF and other organizations strongly encourage the use of UTF-8; also, all XML processors are guaranteed to support it.
out
- stream on which the document will be written
IOException
write(java.io.Writer,java.lang.String)
static String java2std(String encodingName)
public void write(Writer out, String encoding) throws IOException
Note that the document will by default be "pretty printed". Extra whitespace is added to indent children of elements according to their level of nesting, unless those elements have (or inherit) the xml:space='preserve' attribute value. This space will be removed if, when the document is read back with DOM, a call to ElementNode.normalize is made. To avoid this pretty printing, use a write context configured to disable it, or explicitly assign an xml:space='preserve' attribute to the root node of your document.
Also, if a SAX parser was used to construct this tree, data will have been discarded. Most of that will be insignificant in terms of a "logical" view of document data: comments, whitespace outside of the top level element, the exact content of the XML directive, and entity references were expanded. However, if a DOCTYPE declaration was provided, it was also discarded. Such declarations will often be logically significant, due to the attribute value defaulting and normalization they can provide.
In general, DOM does not support "round tripping" data from XML to DOM and back without losing data about physical structures and DTD information. "Logical structure" will be preserved.
out
- the writer to use when writing the documentencoding
- the encoding name to use; this should be a
standard encoding name registered with the IANA (like "UTF-8")
not a Java-internal name (like "UTF8").
IOException
setDoctype(java.lang.String, java.lang.String, java.lang.String)
,
writeXml(org.apache.crimson.tree.XmlWriteContext)
public XmlWriteContext createWriteContext(Writer out)
out
- stream on which the document will be writtenpublic XmlWriteContext createWriteContext(Writer out, int level)
out
- stream on which the document will be writtenlevel
- initial indent level for pretty-printingpublic void writeXml(XmlWriteContext context) throws IOException
writeXml
in interface XmlWritable
context
- describes how to write the document
IOException
createWriteContext(java.io.Writer)
,
createWriteContext(java.io.Writer,int)
public void writeChildrenXml(XmlWriteContext context) throws IOException
writeChildrenXml
in interface XmlWritable
writeChildrenXml
in class ParentNode
context
- describes how the children should be printed
IOException
void checkChildType(int type) throws org.w3c.dom.DOMException
checkChildType
in class ParentNode
org.w3c.dom.DOMException
public final void setSystemId(String uri)
uri
- The document's system ID, as used when storing
the document.public final String getSystemId()
This URI should not be used when interpreting relative URIs, since the document may be partially stored in external parsed entities with different base URIs. Instead, use methods in the XmlReadable interface as the document is being parsed, so that the correct base URI is available.
getSystemId
in interface DocumentEx
public org.w3c.dom.Node appendChild(org.w3c.dom.Node n) throws org.w3c.dom.DOMException
appendChild
in interface org.w3c.dom.Node
appendChild
in class ParentNode
n
- the new child to be appended
org.w3c.dom.DOMException
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node n, org.w3c.dom.Node refNode) throws org.w3c.dom.DOMException
insertBefore
in interface org.w3c.dom.Node
insertBefore
in class ParentNode
n
- the node to be inserted.refNode
- the node before which this is to be inserted
org.w3c.dom.DOMException
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws org.w3c.dom.DOMException
replaceChild
in interface org.w3c.dom.Node
replaceChild
in class ParentNode
newChild
- the new child to be insertedrefChild
- node which is to be replaced
org.w3c.dom.DOMException
public final short getNodeType()
getNodeType
in interface org.w3c.dom.Node
public final org.w3c.dom.DocumentType getDoctype()
getDoctype
in interface org.w3c.dom.Document
public org.w3c.dom.DocumentType setDoctype(String dtdPublicId, String dtdSystemId, String internalSubset)
dtdPublicId
- Holds a "public identifier" used to identify the
last part of the external DTD subset that is read into the DTD.
This may be omitted, and in any case is ignored unless a system
ID is provided.dtdSystemId
- Holds a "system identifier" (a URI) used to
identify the last part of the external DTD subset that is read
into the DTD. This may be omitted, in which case the document
type will contain at most an internal subset. This URI should
not be a relative URI unless the document will be accessed in a
context from which that relative URI makes sense.internalSubset
- Optional; this holds XML text which will
be put into the internal subset. This must be legal syntax,
and it is not tested by this document.public org.w3c.dom.Element getDocumentElement()
getDocumentElement
in interface org.w3c.dom.Document
public final void setElementFactory(ElementFactory factory)
setElementFactory
in interface DocumentEx
factory
- the element factory to be used; if this is null,
all elements will be implemented by ElementNode.public final ElementFactory getElementFactory()
getElementFactory
in interface DocumentEx
public org.w3c.dom.Element createElement(String tagName) throws org.w3c.dom.DOMException
createElement
in interface org.w3c.dom.Document
tagName
- the tag of the element, used to determine what
type element to create as well as what tag to assign the new node.
IllegalArgumentException
- if a mapping is defined,
but is invalid because the element can't be instantiated or
does not subclass ElementNode.
org.w3c.dom.DOMException
public org.w3c.dom.Element createElementNS(String namespaceURI, String qualifiedName) throws org.w3c.dom.DOMException
createElementNS
in interface org.w3c.dom.Document
org.w3c.dom.DOMException
public final ElementEx createElementEx(String tagName) throws org.w3c.dom.DOMException
createElementEx
in interface ElementFactory
tagName
- the tag of the element, used to determine what
type element to create as well as what tag to assign the new node.
IllegalArgumentException
- if a mapping is defined,
but is invalid because the element can't be instantiated or
does not subclass ElementNode.
org.w3c.dom.DOMException
public final ElementEx createElementEx(String uri, String tagName) throws org.w3c.dom.DOMException
createElementEx
in interface ElementFactory
uri
- The namespace used to determine what type of element to
create. This is not stored with the element; the element must be
inserted into a DOM tree in a location where namespace declarations
cause its tag to be interpreted correctly.tagName
- The tag of the element, which should not contain
any namespace prefix.
IllegalArgumentException
- When a mapping is defined,
but is invalid because the element can't be instantiated or
does not subclass ElementNode.
org.w3c.dom.DOMException
public org.w3c.dom.Text createTextNode(String text)
createTextNode
in interface org.w3c.dom.Document
text
- The contents of the text node being created, which
should never contain "]]>".public org.w3c.dom.CDATASection createCDATASection(String text)
createCDATASection
in interface org.w3c.dom.Document
text
- the text which the CDATA section will hold, which
should never contain "]]>".TextNode newText(char[] buf, int offset, int len) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public org.w3c.dom.ProcessingInstruction createProcessingInstruction(String target, String instructions) throws org.w3c.dom.DOMException
createProcessingInstruction
in interface org.w3c.dom.Document
target
- the target of the processing instructioninstructions
- the processing instruction, which should
never contain "?>".
org.w3c.dom.DOMException
public org.w3c.dom.Attr createAttribute(String name) throws org.w3c.dom.DOMException
createAttribute
in interface org.w3c.dom.Document
name
- the name of the attribute.
org.w3c.dom.DOMException
public org.w3c.dom.Attr createAttributeNS(String namespaceURI, String qualifiedName) throws org.w3c.dom.DOMException
createAttributeNS
in interface org.w3c.dom.Document
org.w3c.dom.DOMException
public org.w3c.dom.Comment createComment(String data)
createComment
in interface org.w3c.dom.Document
data
- The characters which will be in the comment.
This should not include the "--" characters.public org.w3c.dom.Document getOwnerDoc()
public org.w3c.dom.DOMImplementation getImplementation()
DOMImplementation
object that handles this document.
getImplementation
in interface org.w3c.dom.Document
public org.w3c.dom.DocumentFragment createDocumentFragment()
createDocumentFragment
in interface org.w3c.dom.Document
public org.w3c.dom.EntityReference createEntityReference(String name) throws org.w3c.dom.DOMException
createEntityReference
in interface org.w3c.dom.Document
name
- the name of the the parsed entity
org.w3c.dom.DOMException
public final String getNodeName()
getNodeName
in interface org.w3c.dom.Node
public org.w3c.dom.Node cloneNode(boolean deep)
Note: At this time, any element factory or document type associated with this document will not be cloned.
cloneNode
in interface org.w3c.dom.Node
deep
- if true, child nodes are also cloned.public final void changeNodeOwner(org.w3c.dom.Node node) throws org.w3c.dom.DOMException
changeNodeOwner
in interface DocumentEx
node
-
org.w3c.dom.DOMException
- WRONG_DOCUMENT_ERROR when attempting
to change the owner for some other DOM implementationHIERARCHY_REQUEST_ERROR when the node is a document, document type, entity, or notation; or when it is an attribute associated with an element whose owner is not being (recursively) changed.
public org.w3c.dom.Element getElementById(String elementId)
Element
whose ID
is given by
elementId
.
getElementById
in interface org.w3c.dom.Document
public ElementEx getElementExById(String id)
This may be used to implement internal IDREF linkage, as well as some kinds of XPointer linkage as used in current drafts of XLink.
getElementExById
in interface DocumentEx
id
- The value of the ID attribute which will be matched
by any element which is returned.public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep) throws org.w3c.dom.DOMException
importNode
in interface org.w3c.dom.Document
org.w3c.dom.DOMException
public void trimToSize()
void reduceWaste()
public final boolean hasChildNodes()
hasChildNodes
in interface org.w3c.dom.Node
hasChildNodes
in class NodeBase
public final org.w3c.dom.Node getFirstChild()
getFirstChild
in interface org.w3c.dom.Node
getFirstChild
in class NodeBase
public final org.w3c.dom.Node getLastChild()
getLastChild
in interface org.w3c.dom.Node
getLastChild
in class NodeBase
public final int getLength()
getLength
in interface org.w3c.dom.NodeList
getLength
in class NodeBase
public final org.w3c.dom.Node item(int i)
item
in interface org.w3c.dom.NodeList
item
in class NodeBase
public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
removeChild
in interface org.w3c.dom.Node
removeChild
in class NodeBase
oldChild
- the node which is to be removed
org.w3c.dom.DOMException
- thrown always.public org.w3c.dom.NodeList getElementsByTagName(String tagname)
tagname
- the tag name to show; or "*" for all elements.
public org.w3c.dom.NodeList getElementsByTagNameNS(String namespaceURI, String localName)
public final int getIndexOf(org.w3c.dom.Node maybeChild)
getIndexOf
in interface NodeEx
getIndexOf
in class NodeBase
maybeChild
- the node which may be a child of this one
public void normalize()
NodeBase
normalize
in interface org.w3c.dom.Node
normalize
in class NodeBase
As a compatible extension to DOM, this normalizes treatment of whitespace except when the xml:space='preserve' attribute value applies to a node. All whitespace is normalized to one space. This ensures that text which is pretty-printed and then reread (and normalized) retains the same content.
public int removeWhiteSpaces(char[] buf)
ParentNode getParentImpl()
public boolean isReadonly()
NodeEx
isReadonly
in interface NodeEx
true
if the node is read onlypublic void setReadonly(boolean deep)
NodeEx
setReadonly
in interface NodeEx
deep
- If true
recursively set the nodes in the
subtree under the current node to be read only.
If false
then set only the current node to be
readonlypublic String getLanguage()
xml:lang
attribute) applicable to this node, if known. Traces up
through ancestors as needed.
getLanguage
in interface NodeEx
public String getInheritedAttribute(String name)
getInheritedAttribute
in interface NodeEx
name
- identifies the attribute; colons may be included,
but namespace prefixes are not interpreted
public org.w3c.dom.Node getParentNode()
getParentNode
in interface org.w3c.dom.Node
void setParentNode(ParentNode arg, int index) throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
protected void setOwnerDocument(XmlDocument doc)
public org.w3c.dom.Document getOwnerDocument()
getOwnerDocument
in interface org.w3c.dom.Node
public void setNodeValue(String value)
setNodeValue
in interface org.w3c.dom.Node
public String getNodeValue()
getNodeValue
in interface org.w3c.dom.Node
public org.w3c.dom.NodeList getChildNodes()
In this implementation, nodes provide such access without needing another node as an intermediary; "this" is returned.
getChildNodes
in interface org.w3c.dom.Node
public org.w3c.dom.Node getNextSibling()
getNextSibling
in interface org.w3c.dom.Node
public org.w3c.dom.Node getPreviousSibling()
getPreviousSibling
in interface org.w3c.dom.Node
public org.w3c.dom.NamedNodeMap getAttributes()
getAttributes
in interface org.w3c.dom.Node
public boolean isSupported(String feature, String version)
isSupported
in interface org.w3c.dom.Node
public String getNamespaceURI()
getNamespaceURI
in interface org.w3c.dom.Node
public String getPrefix()
getPrefix
in interface org.w3c.dom.Node
public void setPrefix(String prefix) throws org.w3c.dom.DOMException
setPrefix
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
public String getLocalName()
getLocalName
in interface org.w3c.dom.Node
public boolean hasAttributes()
hasAttributes
in interface org.w3c.dom.Node
String getMessage(String messageId)
String getMessage(String messageId, Object[] parameters)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |