org.web3d.vrtp.dabp
Class XMLUtilities

java.lang.Object
  |
  +--org.web3d.vrtp.dabp.XMLUtilities

public class XMLUtilities
extends java.lang.Object

XMLUtilities A collection of utility methods for XML. These are all operations that are needed in serveral places, but don't really belong in the classes where they are called from. so they're all collected here for use by all. Most/all of these methods are class/static methods; you shouldn't be instantiating instances of XMLUtilities.

Author:
Don McGregor Date: 2/25/99

Constructor Summary
XMLUtilities()
           
 
Method Summary
static org.w3c.dom.Element findDirInElement(org.w3c.dom.Element pEl)
          It seems that elements children are sandwiched between a couple #text nodes in the parse tree.
static org.w3c.dom.Element findUniqueTagInParseTree(org.w3c.dom.Node branch, java.lang.String tagName)
          Find the unique tag name passed in, within the parse tree passed in.
static boolean hasImmediateChildTag(org.w3c.dom.Element pTag, java.lang.String pTagName)
          Given a node, returns true if one of its _immediate_ children has a tag of the given name.
static java.util.Vector immediateChildElements(org.w3c.dom.Element pTag, java.lang.String pTagName)
          returns a vector containing the immediate children of the tag that are Elements.
static java.util.Vector immediateChildElementsWithNames(org.w3c.dom.Element pTag, java.util.Vector pTagNames)
          Given a list of names, this returns a vector of all the immediate (no grandkids allowed) elements under this tag with those names.
static java.lang.String markupTextForElement(org.w3c.dom.Element pTag)
          given a simple element, someString, returns the "someString" value.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLUtilities

public XMLUtilities()
Method Detail

findDirInElement

public static org.w3c.dom.Element findDirInElement(org.w3c.dom.Element pEl)
It seems that elements children are sandwiched between a couple #text nodes in the parse tree. So if we have a parse tree with an element and one "real" child, there will also be #text nodes preceeding and following the "real" child. This returns only the "real" child.

findUniqueTagInParseTree

public static org.w3c.dom.Element findUniqueTagInParseTree(org.w3c.dom.Node branch,
                                                           java.lang.String tagName)
Find the unique tag name passed in, within the parse tree passed in. This returns null if the named tag is not found, or if more than one tag with that name is found.

markupTextForElement

public static java.lang.String markupTextForElement(org.w3c.dom.Element pTag)
given a simple element, someString, returns the "someString" value.

hasImmediateChildTag

public static boolean hasImmediateChildTag(org.w3c.dom.Element pTag,
                                           java.lang.String pTagName)
Given a node, returns true if one of its _immediate_ children has a tag of the given name.

immediateChildElements

public static java.util.Vector immediateChildElements(org.w3c.dom.Element pTag,
                                                      java.lang.String pTagName)
returns a vector containing the immediate children of the tag that are Elements. This is similar to getElementsByTagName, but doesn't descend the full depth of the tree.

immediateChildElementsWithNames

public static java.util.Vector immediateChildElementsWithNames(org.w3c.dom.Element pTag,
                                                               java.util.Vector pTagNames)
Given a list of names, this returns a vector of all the immediate (no grandkids allowed) elements under this tag with those names. This is similar to immediateChildElements, but looks for more than one tag name.