org.cantaloop.cgimlet
Class XMLUtils
java.lang.Object
|
+--org.cantaloop.cgimlet.XMLUtils
- public final class XMLUtils
- extends java.lang.Object
This class provides some useful methods that helps you
with common XML tasks.
- Version:
- 0.2.0 ($Revision: 1.3 $)
- Author:
- Stefan Heimann
Method Summary |
static org.dom4j.QName |
getQName(java.lang.String name,
org.dom4j.Element reference)
Get the QName of a raw name.
|
static java.util.List |
namespacedElements(org.dom4j.Element parent,
org.dom4j.Namespace ns)
Get a list with the direct children of parent
that are in namespace ns . |
static org.dom4j.Document |
parse(java.io.File f)
Parse the file f and return the xml document. |
static org.dom4j.Document |
parse(java.io.InputStream is)
Parse the input stream and return the xml document. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLUtils
public XMLUtils()
parse
public static final org.dom4j.Document parse(java.io.File f)
- Parse the file
f
and return the xml document.
- Parameters:
f
- a File
value- Returns:
- a
Document
value
parse
public static final org.dom4j.Document parse(java.io.InputStream is)
- Parse the input stream and return the xml document.
namespacedElements
public static java.util.List namespacedElements(org.dom4j.Element parent,
org.dom4j.Namespace ns)
- Get a list with the direct children of
parent
that are in namespace ns
.
- Parameters:
parent
- an Element
valuens
- a Namespace
value- Returns:
- a
List
value
getQName
public static final org.dom4j.QName getQName(java.lang.String name,
org.dom4j.Element reference)
- Get the
QName
of a raw name.
For example:
xsd:string -> new QName("string", ns)
where ns
is the namespace of the
prefix xsd
. To determine this namespace, the
element reference
is used.
- Parameters:
name
- a String
valuereference
- an Element
value- Returns:
- a
QName
value