|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.uniba.euromath.tools.xml.DomTools
@Deprecated public final class DomTools
DomTools for document package.
Constructor Summary | |
---|---|
DomTools()
Deprecated. |
Method Summary | |
---|---|
static void |
clearAttributes(Node node)
Deprecated. Removes all attribute nodes (including xmlns: attributes)
from given node. |
static void |
clearChildren(Node node,
boolean checkUndeletable)
Deprecated. Deletes all child nodes in the node (all nodes from the document, for example). |
static boolean |
containsElements(Node node)
Deprecated. Checks, whether given node contains some elements also, or it contains text/comments/pi only. |
static boolean |
equalsNodeNamespace(Node node1,
Node node2)
Deprecated. Returns true if the two Nodes are from same namespace. |
static boolean |
equalsNodeQName(Node node1,
Node node2)
Deprecated. Returns true if the two Nodes have same qname (namespace
and localname). |
static boolean |
equalsNodeQName(Node node,
QName name)
Deprecated. Returns true if the node is from given namespace and has
name localName. |
static boolean |
equalsNodeQName(Node node,
String namespaceURI,
String localName)
Deprecated. Returns true if the node is from provided namespace and has name localName. |
static boolean |
equalsQName(QName qname,
String namespace,
String localName)
Deprecated. Returns true if given qname represents given namespace and
local name. |
static boolean |
equalsURI(String uri1,
String uri2)
Deprecated. Returns true if the two uri are equal. |
static void |
getAttributes(Node n,
List<Attr> list,
boolean descendants)
Deprecated. Appends all attribute nodes from given element to given list. |
static List<Element> |
getChildElements(Node node)
Deprecated. Returns all elements, that are children of given node. |
static String |
getErrorMessage(DOMError err)
Deprecated. Distills the detailed error message from the error object. |
static Element |
getFirstChildElement(Node node)
Deprecated. Returns first element contained in the node. |
static Node |
getFirstDescendantOrSelfIdentifiableNode(Node node)
Deprecated. Returns first identifiable node encountered on descendant-or-self axis of given node. |
static CharacterData |
getFirstDescendantOrSelfTextualNode(Node node)
Deprecated. Returns first textual node encountered on descendant-or-self axis of given node. |
static Node |
getLastDescendantOrSelfIdentifiableNode(Node node)
Deprecated. Returns last identifiable node encountered on descendant-or-self axis of given node. |
static CharacterData |
getLastDescendantOrSelfTextualNode(Node node)
Deprecated. Returns last textual node encountered. |
static String |
getMarkElementId(Element e)
Deprecated. Retrieves ID from the emp:mark element. |
static Node |
getNearestCommonAscendant(Node node1,
Node node2)
Deprecated. Computes and returns common ascendant for both nodes. |
static int |
getNodeIndex(Node node)
Deprecated. Returns zero-based index of node (i.e. |
static List<Node> |
getNodePathToRoot(Node node)
Deprecated. Returns path from given node to the root node. |
static Node |
getParentContainer(Node node)
Deprecated. Returns the parent container of the node. |
static Element |
getParentElement(Node node)
Deprecated. Returns the parent element of the node. |
static String |
getPathToRoot(Node node)
Deprecated. Returns human-readable path from given element to root of document, in a form /root/.../element . |
static QName |
getQName(Node node)
Deprecated. Returns QName object containing qualified name of given node. |
static QName |
getQName(String uri,
String localName,
String qName)
Deprecated. Converts SAX-style qname to the QName instance. |
static Element |
getRootElement(DOMSource source)
Deprecated. Returns root element of given source. |
static String |
getTextContents(Node node,
org.w3c.dom.traversal.NodeFilter filter)
Deprecated. Retrieves textual value of the node: all nodes except element, text, cdata and entity are ignored. |
static boolean |
hasEmptyContent(Node node)
Deprecated. Checks if node has empty content: empty text nodes, empty entities, entities that contains empty text nodes or empty entities etc. |
static boolean |
inEntity(Node node)
Deprecated. Queries if the given node is a descendant of an EntityReference node. |
static boolean |
isContainer(Node node)
Deprecated. Checks if given node is able to contain other nodes as its children. |
static boolean |
isContentNode(Node node)
Deprecated. Returns true if the node is a content node: if it can be a
part of DOM document content. |
static boolean |
isDocumentRoot(Node node)
Deprecated. Checks if the node is a root node. |
static boolean |
isEmptyEntity(Node node)
Deprecated. Check if given node is an empty entity. |
static boolean |
isEntity(Node node)
Deprecated. Checks if given node is entity or entity reference node. |
static boolean |
isPartiallySelectable(Node node)
Deprecated. Checks if the node is partially selectable. |
static boolean |
isPartiallySelectable(short nodeType)
Deprecated. Checks if the node is partially selectable. |
static boolean |
isRootNode(Node node)
Deprecated. Checks if this node is a root node in the node hierarchy. |
static boolean |
isText(Node node)
Deprecated. Checks if the node is a textual node - text or cdata node. |
static boolean |
isText(short nodeType)
Deprecated. Checks if the node is a textual node - text or cdata node. |
static boolean |
isTextualEntity(Node node)
Deprecated. Checks if given node is an entity reference that contains text/cdata nodes only. |
static boolean |
isTextualNode(Node node)
Deprecated. Returns true if the node represents text only - itself is textual or it is a pure-textual entity. |
static DocumentFragment |
moveContentToFragment(Document doc)
Deprecated. Moves all content nodes from the document into newly created document fragment. |
static List<Node> |
nodeListToList(NodeList nodeList)
Deprecated. Converts nodeList to List. |
static String |
printQName(Node node)
Deprecated. Prints given node qname as a prefix:localname pair. |
static String |
printQName(QName qname)
Deprecated. Prints given qname as a prefix:localname pair. |
static String |
printQName(String prefix,
String local)
Deprecated. Prints given qname as a prefix:localname pair. |
static void |
removeXmlns(Element e)
Deprecated. Removes all xmlns attributes from given element. |
static void |
setReadOnly(Node node,
boolean readOnly,
boolean deep)
Deprecated. Description copied from Xerces 2.7.1 NodeImpl.setReadOnly(boolean, boolean) method. |
static DocumentFragment |
toFragment(Node node)
Deprecated. Converts the node into a document fragment. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DomTools()
Method Detail |
---|
public static boolean equalsURI(String uri1, String uri2)
uri1
- first uriuri2
- second uri
uri1 == null ? uri2 == null : uri1.equals(uri2)
public static boolean equalsNodeQName(Node node, String namespaceURI, String localName)
node
- Node to check.namespaceURI
- namespace that the node must be from.localName
- name that must node have.
namespaceURI:localName
public static boolean equalsNodeQName(Node node, QName name)
true
if the node is from given namespace and has
name localName.
node
- Node to check.name
- qualified name.
true
if name of node is from
namespaceURI:localName
public static boolean equalsNodeNamespace(Node node1, Node node2)
true
if the two Nodes are from same namespace.
node1
- First Node to compare.node2
- Second Node to compare.
true
if the two Nodes are from same namespace.public static boolean equalsNodeQName(Node node1, Node node2)
true
if the two Nodes have same qname (namespace
and localname).
node1
- First Node to compare.node2
- Second Node to compare.
true
if the two Nodes are from same namespace and
have same localname.public static boolean equalsQName(QName qname, String namespace, String localName)
true
if given qname represents given namespace and
local name.
qname
- qualified name.namespace
- the namespace to check.localName
- local name to check.
true
if both namespace and localname are equal,
false
otherwise.public static int getNodeIndex(Node node)
node
- the node to test.
-1
if null
was
given.public static void clearChildren(Node node, boolean checkUndeletable)
node
- the node.checkUndeletable
- if true
then function will fail if
undeletable element occurs.
IllegalArgumentException
- if node is entity, entity reference or
notation node.public static List<Element> getChildElements(Node node)
node
- the node to process
null
.public static boolean isText(Node node)
node
- the node to check.
true
if node is Text
or CDATASection
node, false
otherwise.public static boolean isText(short nodeType)
nodeType
- the node type to check.
true
if node is Text
or CDATASection
node, false
otherwise.public static boolean isPartiallySelectable(Node node)
node
- node to check.
true
if node is Text
,
CDATASection
or Comment
,
false
otherwise.public static boolean isPartiallySelectable(short nodeType)
nodeType
- the node type to check.
true
if node is Text
,
CDATASection
or Comment
,
false
otherwise.public static boolean inEntity(Node node)
EntityReference
node.
node
- node to check.
EntityReference
node. In case of attribute the function checks if its owner element is in
entity. If the node itself is EntityReference
node but is
not contained in other entity reference node then the result is
false
.public static Element getParentElement(Node node)
node.getParentNode()
when the node is in an entity
reference node.
node
- the node to check.
null
if and only if
given node is the root node of some document, document or document
fragment.
IllegalArgumentException
- if the node does not have a parent.public static Node getParentContainer(Node node)
node.getParentNode()
when the node is in an entity
reference node. A container is an ID-level node holder; it is never an
entity reference, for example. It is equal to
getParentElement
if it is not null
. If
getParentElement
is null
then this
container is a Document or document fragment instance.
node
- the node to check.
null
if and only
if given node is disconnected from any element, document or document
fragment node.
IllegalArgumentException
- if the node does not have a parent.public static boolean containsElements(Node node)
node
- the node.
public static boolean isTextualEntity(Node node)
node
- node to check.
public static boolean hasEmptyContent(Node node)
node
- the nodes to check
public static boolean isEmptyEntity(Node node)
node
- node to check.
true
if the node is an empty entity and it has
empty content.public static boolean isEntity(Node node)
node
- the node to check.
true
if node is entity or entity reference node,
false
otherwise.public static boolean isTextualNode(Node node)
node
- node to check
public static CharacterData getFirstDescendantOrSelfTextualNode(Node node)
node
- the node to check.
public static Node getFirstDescendantOrSelfIdentifiableNode(Node node)
node
- the node to check.
public static Node getLastDescendantOrSelfIdentifiableNode(Node node)
node
- the node to check.
null
.public static CharacterData getLastDescendantOrSelfTextualNode(Node node)
node
- the node to check.
null
.public static boolean isDocumentRoot(Node node)
null
parent or its parent is document or document
fragment.
node
- the node to check.
true
if the node is a root node of some document.public static boolean isContainer(Node node)
node
- node to check
public static String printQName(String prefix, String local)
local
- the local part of the qname.prefix
- the prefix of the qname.
public static String printQName(Node node)
node
- the node
public static String printQName(QName qname)
qname
- the qname
public static QName getQName(Node node)
node
- node to convert. Must be element or attribute node.
public static QName getQName(String uri, String localName, String qName)
QName
instance.
uri
- the Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace processing is not being performedlocalName
- the local name (without prefix), or the empty string if
Namespace processing is not being performedqName
- the qualified XML name (with prefix), or the empty string if
qualified names are not available
public static boolean isContentNode(Node node)
true
if the node is a content node: if it can be a
part of DOM document content.
node
- node to check.
true
if the node is an attribute, element, text,
cdata, pi, comment or entity reference node.public static DocumentFragment moveContentToFragment(Document doc)
doc
- the document node.
public static DocumentFragment toFragment(Node node)
moveContentToFragment
method. If node
is content node then it shall be the sole child of the returned fragment.
node
- node to convert.
IllegalArgumentException
- if node is not fragment, document nor
content node.public static Element getFirstChildElement(Node node)
node
- node to scan
null
if no such
element exists.public static void clearAttributes(Node node)
xmlns:
attributes)
from given node.
node
- remove attributes from this node. Only element can have
attributes hence function does nothing for other types of nodes.
UnremovableAttributeException
- if some
attributes are not removable.public static void removeXmlns(Element e)
e
- element to modify.
UnremovableAttributeException
- if an unremovable xmlns attribute
occured.public static String getPathToRoot(Node node)
/root/.../element
. Only local names are displayed,
no namespaces. Useful for printing element location.
node
- display path for this node (element or entity reference).
public static Element getRootElement(DOMSource source)
source
- the source to analyze.
null
if no element node is
attached to source's node.public static String getMarkElementId(Element e)
emp:mark
element. If the node is not
an emp:mark
element, the function fails.
e
- the emp:mark
element instance.
emp:mark
points. Never null
.public static List<Node> nodeListToList(NodeList nodeList)
nodeList
- the node list.
public static String getErrorMessage(DOMError err)
err
- error to analyze.
public static void setReadOnly(Node node, boolean readOnly, boolean deep)
Description copied from Xerces 2.7.1
NodeImpl.setReadOnly(boolean, boolean)
method.
NON-DOM: PR-DOM-Level-1-19980818 mentions readonly nodes in conjunction with Entities, but provides no API to support this.
Most DOM users should not touch this method. Its anticpated use is during construction of EntityRefernces, where it will be used to lock the contents replicated from Entity so they can't be casually altered. It _could_ be published as a DOM extension, if desired.
node
- the node to modifyreadOnly
- true
or false
as desired.deep
- If true
, children are also toggled. Note that
this will not change the state of an EntityReference or its children,
which are always read-only.public static String getTextContents(Node node, org.w3c.dom.traversal.NodeFilter filter)
node
- node to retrieve textual value from. If attribute is
specified then its value is returned.filter
- filters out nodes. If null
then no nodes are
filtered. The function differentiates NodeFilter.FILTER_SKIP
and
NodeFilter.FILTER_REJECT
.
public static void getAttributes(Node n, List<Attr> list, boolean descendants)
n
- append attributes from this element. emp:id
attribute is ignored.list
- attributes are appended to this list, in no specified order.descendants
- if true
then all descendant elements
are considered.public static List<Node> getNodePathToRoot(Node node)
node
- display path for this node.
root
item - its parent is
null
.public static Node getNearestCommonAscendant(Node node1, Node node2)
node1
- first nodenode2
- second node.
null
.public static boolean isRootNode(Node node)
node
- the node to check.
true
if the parent of the node is
null
or is the node itself.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |