org.enhydra.xml.xmlc
Class XMLCUtil

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.XMLCUtil

public abstract class XMLCUtil
extends Object

Utility methods for dealing with DOMs.


Field Summary
static int PRINT_ALL
          Deprecated. Use DOMInfo
static int PRINT_CDATA
          Deprecated. Use DOMInfo
static int PRINT_COMMENT
          Deprecated. Use DOMInfo
static int PRINT_DEFAULT
          Deprecated. Use DOMInfo
static int PRINT_DOCUMENTTYPE
          Deprecated. Use DOMInfo
static int PRINT_TEXT
          Deprecated. Use DOMInfo
 
Constructor Summary
XMLCUtil()
           
 
Method Summary
static Node copyNode(Node srcNode, Document destDocument)
          Deprecated. use org.w3c.dom.Document.importNode
static Text findFirstText(Node node)
          Find the first text descendent node of an element.
static Attr getAttributeByName(Node node, String name)
          Deprecated. use org.w3c.dom.Element#getAttributeNode
static Element getElementById(String id, Node node)
          Recursively search for an element by id starting at a node.
static Text getFirstText(Node node)
          Find the first text descendent node of an element.
static Element getRequiredElementById(String id, Node node)
          Recursively search for an required element by id starting at a node.
static void printNode(String msg, Node node, int options, PrintWriter out)
          Deprecated. Use DOMInfo
static void printNode(String msg, Node node, OutputStream out)
          Deprecated. Use DOMInfo
static void printNode(String msg, Node node, PrintWriter out)
          Deprecated. Use DOMInfo
static Node replaceNode(Node srcNode, Node destNode)
          Deprecated. use org.enhydra.xml.dom.DOMOps#replaceNode
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRINT_COMMENT

public static final int PRINT_COMMENT
Deprecated. Use DOMInfo

See Also:
DOMInfo.printTree(java.lang.String, org.w3c.dom.Node, int, java.io.PrintWriter)

PRINT_TEXT

public static final int PRINT_TEXT
Deprecated. Use DOMInfo

See Also:
DOMInfo.printTree(java.lang.String, org.w3c.dom.Node, int, java.io.PrintWriter)

PRINT_CDATA

public static final int PRINT_CDATA
Deprecated. Use DOMInfo

See Also:
Option to printNode to print the contents of Text nodes.

PRINT_DOCUMENTTYPE

public static final int PRINT_DOCUMENTTYPE
Deprecated. Use DOMInfo

See Also:
Option to printNode to print the contents of DocumentType nodes.

PRINT_ALL

public static final int PRINT_ALL
Deprecated. Use DOMInfo

See Also:
All Print options.

PRINT_DEFAULT

public static final int PRINT_DEFAULT
Deprecated. Use DOMInfo

See Also:
Default print options.
Constructor Detail

XMLCUtil

public XMLCUtil()
Method Detail

getAttributeByName

public static Attr getAttributeByName(Node node,
                                      String name)
Deprecated. use org.w3c.dom.Element#getAttributeNode

Find an attribute of a node by name.
Parameters:
node - Node who's attribute is desired.
name - The name of the desired attribute.
Returns:
The attribute or null if its not found.
See Also:
Element.getAttributeNode(java.lang.String)

findFirstText

public static Text findFirstText(Node node)
Find the first text descendent node of an element. This recursively looks more than one level to search for text in font nodes, etc.
Parameters:
node - The starting node for the search.
Returns:
The text node or null if not found.

getFirstText

public static Text getFirstText(Node node)
Find the first text descendent node of an element. This recursively looks more than one level to search for text in font nodes, etc. If a text node is not found, generate an error.
Parameters:
node - The starting node for the search.
Returns:
The text node.
Throws:
XMLCError - If a text node was not found.

getElementById

public static Element getElementById(String id,
                                     Node node)
Recursively search for an element by id starting at a node. Assumes id attribute is named "id". With XMLC, it normally better to access elements in a compiled objects directly with the generated access methods. This is provided for working on cloned pieces of the document or other tasks outside of the XMLC generated object.
Parameters:
id - The element id to find. Case is ignored.
node - The node to start the search at.
Returns:
A point the element if found, otherwise null.

getRequiredElementById

public static Element getRequiredElementById(String id,
                                             Node node)
Recursively search for an required element by id starting at a node.
Parameters:
id - The element id to find. Case is ignored.
node - The node to start the search at.
Returns:
A point the element if found.
Throws:
XMLCError - Thrown if the element is not found.
See Also:
getElementById(java.lang.String, org.w3c.dom.Node)

copyNode

public static Node copyNode(Node srcNode,
                            Document destDocument)
Deprecated. use org.w3c.dom.Document.importNode

Copy a node and its children from one document to another.
Parameters:
srcNode - The node to copy.
destDocument - The destination document. The node will belong to this document but will not be inserted in it.
Returns:
The new node.
See Also:
Document.importNode(org.w3c.dom.Node, boolean)

replaceNode

public static Node replaceNode(Node srcNode,
                               Node destNode)
Deprecated. use org.enhydra.xml.dom.DOMOps#replaceNode

Replace a node with a given one from another document.
Parameters:
srcElement - The node to clone and insert
destElement - The node to be replaced
Returns:
the new node that replaces the destination node
See Also:
DOMOps.replaceNode(org.w3c.dom.Node, org.w3c.dom.Node)

printNode

public static void printNode(String msg,
                             Node node,
                             int options,
                             PrintWriter out)
Deprecated. Use DOMInfo

See Also:
DOMInfo.printTree(java.lang.String, org.w3c.dom.Node, int, java.io.PrintWriter)

printNode

public static void printNode(String msg,
                             Node node,
                             PrintWriter out)
Deprecated. Use DOMInfo

See Also:
DOMInfo.printTree(java.lang.String, org.w3c.dom.Node, int, java.io.PrintWriter)

printNode

public static void printNode(String msg,
                             Node node,
                             OutputStream out)
Deprecated. Use DOMInfo

See Also:
DOMInfo.printTree(java.lang.String, org.w3c.dom.Node, int, java.io.PrintWriter)


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.