org.jopendocument.util
Class XPathUtils

java.lang.Object
  extended by org.jopendocument.util.XPathUtils

public final class XPathUtils
extends Object

Author:
Sylvain CUAZ

Method Summary
static String basename(String path)
          Compute the name of the last part of the path.
static String localName(String qName)
          Compute the local name of a qualified name.
static String namespace(String qName)
          Compute the namespace prefix of a qualified name.
static String parentOf(String path)
          Compute the parent of a path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parentOf

public static final String parentOf(String path)
Compute the parent of a path. Note : path must lead to an element.

Parameters:
path - the path with at least one slash, eg "./elem".
Returns:
the parent of path, eg ".".

basename

public static final String basename(String path)
Compute the name of the last part of the path.

Parameters:
path - the path, eg "./elem" or "elem".
Returns:
the name, eg "elem".

namespace

public static final String namespace(String qName)
Compute the namespace prefix of a qualified name. NOTE : this also works if qName is a path, eg "./office:body/office:text".

Parameters:
qName - a qualified name, eg "office:text".
Returns:
the prefix or null if there's none, eg "office".

localName

public static final String localName(String qName)
Compute the local name of a qualified name. NOTE : this also works if qName is a path, eg "./office:body/office:text" or if there's no prefix, eg "./office:body/child".

Parameters:
qName - a qualified name, eg "office:text".
Returns:
the local name, eg "text".


Copyright © 2010 jOpenDocument All Rights Reserved.