|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectspv.util.XMLUtilities
public class XMLUtilities
Utililty methods to handle XML issues.
| Field Summary | |
|---|---|
private static java.lang.String |
DATE
|
private static java.lang.String |
VERSION
|
| Constructor Summary | |
|---|---|
XMLUtilities()
|
|
| Method Summary | |
|---|---|
static void |
BuildDOMElement(org.w3c.dom.Document document,
com.sun.xml.tree.ElementNode parent,
java.lang.String name,
java.lang.String value)
Builds a DOM element. |
static java.util.Map |
BuildMapFromNode(org.w3c.dom.Node node)
Builds a map with all the non-text (empty) child nodes in a parent node. |
static java.util.List |
BuildNodeList(org.w3c.dom.Node node)
Builds a list with all the non-text (empty) child nodes in a parent node. |
static com.sun.xml.tree.ElementNode |
createRootElement(com.sun.xml.tree.XmlDocument document,
java.lang.String name)
Creates a root element. |
static java.lang.String |
GetAttributeValueFromMap(java.util.Map map,
java.lang.String name,
java.lang.String attrname)
Gets a named attribute from a node. |
static boolean |
GetBooleanValueFromMap(java.util.Map map,
java.lang.String name)
Gets a boolean value from a map of nodes. |
static double |
GetDoubleValueFromMap(java.util.Map map,
java.lang.String name)
Gets a double value from a map of nodes. |
static int |
GetIntValueFromMap(java.util.Map map,
java.lang.String name)
Gets a integer value from a map of nodes. |
static org.w3c.dom.Node |
GetNodeFromMap(java.util.Map map,
java.lang.String name)
Gets a named node from a map of nodes. |
static java.lang.Object |
GetObjectFromMap(java.util.Map map,
java.lang.String name,
java.lang.String class_attr)
Gets an object from a map of nodes. |
static java.lang.String |
GetStringValueFromMap(java.util.Map map,
java.lang.String name)
Gets a string value from a map of nodes. |
static org.w3c.dom.Document |
OpenXMLDocument(java.net.URL url)
Creates Document instance from a URL. |
static org.w3c.dom.Node |
validateDOMDocument(org.w3c.dom.Document document)
Validates a DOM document. |
static void |
writeXMLContext(com.sun.xml.tree.ElementNode root,
java.lang.String fname)
Writes a DOM tree to a file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String VERSION
private static final java.lang.String DATE
| Constructor Detail |
|---|
public XMLUtilities()
| Method Detail |
|---|
public static org.w3c.dom.Document OpenXMLDocument(java.net.URL url)
url - the URL
public static void writeXMLContext(com.sun.xml.tree.ElementNode root,
java.lang.String fname)
throws java.io.IOException
root - the root element nodefname - the file name
java.io.IOException
public static com.sun.xml.tree.ElementNode createRootElement(com.sun.xml.tree.XmlDocument document,
java.lang.String name)
document - the XML documentname - the name of the root attribute
public static org.w3c.dom.Node validateDOMDocument(org.w3c.dom.Document document)
throws org.w3c.dom.DOMException,
java.lang.NullPointerException
For now, this method checks the version number inscribed by
createRootElement and issues a warning if it differs
from the current version. If the document is mal-formed, a
fatal error can be generated.
The version checking warning is temporarily disabled in this version.
document - the document
Node, or null
if it fails to open the document.
org.w3c.dom.DOMException - NullPointerException
java.lang.NullPointerException
public static void BuildDOMElement(org.w3c.dom.Document document,
com.sun.xml.tree.ElementNode parent,
java.lang.String name,
java.lang.String value)
document - the document where to build fromparent - the parent elementname - the name of the new elementvalue - the value of the new elementpublic static java.util.Map BuildMapFromNode(org.w3c.dom.Node node)
node - the parent node
public static java.util.List BuildNodeList(org.w3c.dom.Node node)
node - the parent node
public static org.w3c.dom.Node GetNodeFromMap(java.util.Map map,
java.lang.String name)
null is returned instead.
map - the node mapname - the name of the sought node
null if name not found
public static java.lang.String GetAttributeValueFromMap(java.util.Map map,
java.lang.String name,
java.lang.String attrname)
map - the map where to get the node fromname - the node nameattrname - the attribute name
null if not found
public static java.lang.String GetStringValueFromMap(java.util.Map map,
java.lang.String name)
null is returned instead.
map - the node mapname - the name of the sought node
null if name not found
public static boolean GetBooleanValueFromMap(java.util.Map map,
java.lang.String name)
false is returned instead.
map - the node mapname - the name of the sought node
false if name not found
public static int GetIntValueFromMap(java.util.Map map,
java.lang.String name)
map - the node mapname - the name of the sought node
public static double GetDoubleValueFromMap(java.util.Map map,
java.lang.String name)
NaN is returned instead.
map - the node mapname - the name of the sought node
NaN if name not found
public static java.lang.Object GetObjectFromMap(java.util.Map map,
java.lang.String name,
java.lang.String class_attr)
map - the node mapname - the name of the sought nodeclass_attr - the class
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||