jnlp.sample.servlet
Class XMLParsing

java.lang.Object
  extended by jnlp.sample.servlet.XMLParsing

public class XMLParsing
extends Object

Contains handy methods for looking up information stored in XMLNodes.


Nested Class Summary
static class XMLParsing.ElementVisitor
          Iterator class
 
Constructor Summary
XMLParsing()
           
 
Method Summary
static XMLNode convert(Node n)
           
static XMLNode findChildElement(XMLNode elem, String tag)
          Returns an child element with the current tag name or null.
static XMLNode findElementPath(XMLNode elem, String path)
          Parses a path string of the form and returns the specific Element node for that tag, or null if it does not exist.
static String getElementContent(XMLNode root, String path)
          Like getElementContents(...) but with a defaultValue of null
static String getElementContent(XMLNode root, String path, String defaultvalue)
          Returns the value of the last element tag in the path, e.g., <..>value.
static String[] getMultiElementContent(XMLNode root, String path)
          Like getElementContents(...) but with a defaultValue of null
static String getPathString(XMLNode e)
          Returns a string describing the current location in the DOM
static boolean isElementPath(XMLNode root, String path)
          Returns true if the path exists in the document, otherwise false
static void visitChildrenElements(XMLNode elem, XMLParsing.ElementVisitor ev)
           
static void visitElements(XMLNode root, String path, XMLParsing.ElementVisitor ev)
          Visits all elements which matches the .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLParsing

public XMLParsing()
Method Detail

convert

public static XMLNode convert(Node n)

isElementPath

public static boolean isElementPath(XMLNode root,
                                    String path)
Returns true if the path exists in the document, otherwise false


getPathString

public static String getPathString(XMLNode e)
Returns a string describing the current location in the DOM


getElementContent

public static String getElementContent(XMLNode root,
                                       String path)
Like getElementContents(...) but with a defaultValue of null


getMultiElementContent

public static String[] getMultiElementContent(XMLNode root,
                                              String path)
Like getElementContents(...) but with a defaultValue of null


getElementContent

public static String getElementContent(XMLNode root,
                                       String path,
                                       String defaultvalue)
Returns the value of the last element tag in the path, e.g., <..>value. The DOM is assumes to be normalized. If no value is found, the defaultvalue is returned


findElementPath

public static XMLNode findElementPath(XMLNode elem,
                                      String path)
Parses a path string of the form and returns the specific Element node for that tag, or null if it does not exist. If multiple elements exists with same path the first is returned


findChildElement

public static XMLNode findChildElement(XMLNode elem,
                                       String tag)
Returns an child element with the current tag name or null.


visitElements

public static void visitElements(XMLNode root,
                                 String path,
                                 XMLParsing.ElementVisitor ev)
Visits all elements which matches the . The iteration is only done on the last elment in the path.


visitChildrenElements

public static void visitChildrenElements(XMLNode elem,
                                         XMLParsing.ElementVisitor ev)


Copyright © 2005-2011 Sun Microsystems. All Rights Reserved.