edu.umd.cfar.lamp.viper.util
Class XmlHelper

java.lang.Object
  extended byedu.umd.cfar.lamp.viper.util.XmlHelper

public class XmlHelper
extends java.lang.Object

Since:
Jun 20, 2003
Author:
davidm@cfar.umd.edu

Field Summary
static ExceptIterator.ExceptFunctor ELEMENTS_ONLY
          Except-iterator that operates on iterators of DOM nodes, returning only elements in the list.
 
Constructor Summary
XmlHelper()
           
 
Method Summary
static int getQNameSplitPoint(java.lang.String uri)
          Given a uri that represents a qualified name, tries to determine the index of the split point between the namespace and the local name.
static java.lang.String localName(java.lang.String uri)
          Gets the local part of a uri.
static java.lang.String namespacePart(java.lang.String uri)
          gets the namespace part of the uri
static java.util.Iterator nodeList2Iterator(org.w3c.dom.NodeList nl)
          Converts a w3c DOM nodelist into an iterator.
static java.lang.String[] splitIntoQName(java.lang.String uri)
          Splits the rdf-style uri into namespace uri and local name
static java.lang.String unsplit(java.lang.String ns, java.lang.String lname)
          Combined the namespace and the local name back together.
static java.lang.String unsplit(java.lang.String ns, java.lang.String lname, java.lang.String joiner)
          Combined the namespace and the local name back together.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENTS_ONLY

public static final ExceptIterator.ExceptFunctor ELEMENTS_ONLY
Except-iterator that operates on iterators of DOM nodes, returning only elements in the list.

Constructor Detail

XmlHelper

public XmlHelper()
Method Detail

getQNameSplitPoint

public static int getQNameSplitPoint(java.lang.String uri)
Given a uri that represents a qualified name, tries to determine the index of the split point between the namespace and the local name. Returns the last index of #, /, or :, checking for each. If the string contains no :, it doesn't count as a uri and nothing is returned.

Parameters:
uri - the uri
Returns:
the split point, or -1 if not found

localName

public static java.lang.String localName(java.lang.String uri)
Gets the local part of a uri.

Parameters:
uri - the uri to split
Returns:
the local part, if found

namespacePart

public static java.lang.String namespacePart(java.lang.String uri)
gets the namespace part of the uri

Parameters:
uri - the uri to split
Returns:
the namespace part

splitIntoQName

public static java.lang.String[] splitIntoQName(java.lang.String uri)
Splits the rdf-style uri into namespace uri and local name

Parameters:
uri - the uri to split
Returns:
the split uri

unsplit

public static java.lang.String unsplit(java.lang.String ns,
                                       java.lang.String lname)
Combined the namespace and the local name back together.

Parameters:
ns - the namespace uri
lname - the local name
Returns:
the joined uri

unsplit

public static java.lang.String unsplit(java.lang.String ns,
                                       java.lang.String lname,
                                       java.lang.String joiner)
Combined the namespace and the local name back together.

Parameters:
ns - the namespace uri
lname - the local name
joiner - the join string, e.g. #
Returns:
the joined uri

nodeList2Iterator

public static java.util.Iterator nodeList2Iterator(org.w3c.dom.NodeList nl)
Converts a w3c DOM nodelist into an iterator.

Parameters:
nl - the node list
Returns:
the iterator wrapping the list of DOM nodes