|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deegree.xml.XMLTools
XML Tools based on JAXP 1.1 for parsing documents and retrieving node values/node attributes.
Constructor Summary | |
XMLTools()
|
Method Summary | |
static void |
appendNode(org.w3c.dom.Node node,
java.lang.String indent,
java.lang.StringBuffer sb)
Appends a node and it's children to the given StringBuffer. |
static org.w3c.dom.Node |
copyNode(org.w3c.dom.Node source,
org.w3c.dom.Node dest)
copies one node to another node (of a different dom document). |
static org.w3c.dom.Document |
create()
creates a new and empty dom document |
static java.lang.String |
getAttrValue(org.w3c.dom.Node node,
java.lang.String attrName)
Returns the attribute value of the given node. |
static java.lang.String |
getAttrValue(org.w3c.dom.Node node,
java.lang.String namespace,
java.lang.String attrName)
Returns the attribute value of the given node. |
static java.lang.String |
getAttrValue(java.lang.String name,
org.w3c.dom.Node node)
Returns the value of the specified node attribute or null if it is missing. |
static org.w3c.dom.Element |
getChildByName(java.lang.String name,
java.lang.String namespace,
org.w3c.dom.Node node)
Returns the specified child element of the given elemen. |
static ElementList |
getChildElements(org.w3c.dom.Node node)
Returns all child ELEMENTs. |
static ElementList |
getChildElementsByName(java.lang.String name,
java.lang.String namespace,
org.w3c.dom.Node node)
Returns the specified child elements of the given element. |
static double |
getDoubleValue(java.lang.String name,
java.lang.String namespace,
org.w3c.dom.Node node,
double defaultValue)
Returns the numerical value of the text contained in the specified child element of the given element as a double (if it denotes a double). |
static org.w3c.dom.Element |
getFirstElement(org.w3c.dom.Node node)
returns the first child element of the submitted node |
static org.w3c.dom.Element |
getNamedChild(org.w3c.dom.Node node,
java.lang.String name)
returns the first child element of the submitted node |
static org.w3c.dom.Element |
getNamedChild(org.w3c.dom.Node node,
java.lang.String namespace,
java.lang.String name)
Returns the first child element of the submitted node that matches the given namespace and name. |
static java.lang.String |
getRequiredAttrValue(java.lang.String name,
org.w3c.dom.Node node)
Returns the value of the specified node attribute. |
static java.lang.String |
getRequiredAttrValue(java.lang.String name,
java.lang.String namespace,
org.w3c.dom.Node node)
Returns the value of the specified node attribute. // * FIXME: Due to apparent bugs in getNamedItemNS (name, namespace), // * when used to find attribute nodes, the current implementation // * uses a workaround. |
static org.w3c.dom.Element |
getRequiredChildByName(java.lang.String name,
java.lang.String namespace,
org.w3c.dom.Node node)
Returns the specified child element of the given elemen. |
static double |
getRequiredDoubleValue(java.lang.String name,
java.lang.String namespace,
org.w3c.dom.Node node)
Returns the numerical value of the text contained in the specified child element of the given element as a double (if it denotes a double). |
static java.lang.String |
getRequiredStringValue(java.lang.String name,
java.lang.String namespace,
org.w3c.dom.Node node)
Returns the text contained in the specified child element of the given element. |
static java.lang.String |
getStringValue(org.w3c.dom.Node node)
Returns the text contained in the specified element. |
static java.lang.String |
getStringValue(java.lang.String name,
java.lang.String namespace,
org.w3c.dom.Node node,
java.lang.String defaultValue)
Returns the text contained in the specified child element of the given element. |
static java.lang.String |
getValue(org.w3c.dom.Node node)
Returns the concatenated Strings of all children that are TEXT_NODEs. |
static org.w3c.dom.Node |
insertNodeInto(org.w3c.dom.Node source,
org.w3c.dom.Node dest)
inserts a node into a dom element (of a different dom document) |
static org.w3c.dom.Document |
mergeSchemas(org.w3c.dom.Document[] schemas)
the method merges two or more XML-schema definitions into one 'meta'-schema. for this it is nessecary that all into schemas uses the same prefix for namespace: http://www.w3.org/2001/XMLSchema. |
static org.w3c.dom.Document |
parse(java.io.Reader reader)
Parses a XML document and returns a DOM object. |
static org.w3c.dom.Document |
parse(java.lang.String fileName)
Parses a XML document and returns a DOM object. |
static org.w3c.dom.Node |
removeNamedChildNodes(org.w3c.dom.Node node,
java.lang.String nodeName)
removes all direct child nodes of the submitted node with the also submitted name |
static java.lang.String |
toLocalName(java.lang.String nodeName)
extracts the local name from a node name |
static java.lang.StringBuffer |
validateCDATA(java.lang.String cdata)
Checks if a given CDATA-value has to be escaped if it is used as a text value in an XML element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XMLTools()
Method Detail |
public static java.lang.StringBuffer validateCDATA(java.lang.String cdata)
The method is just proofed for a UTF-8 character encoding.
cdata
- value to be used
public static org.w3c.dom.Element getRequiredChildByName(java.lang.String name, java.lang.String namespace, org.w3c.dom.Node node) throws XMLParsingException
name
- name of the child elementnamespace
- namespace of the child elementnode
- current element
XMLParsingException
- specified child element is missing and
required is truepublic static org.w3c.dom.Element getChildByName(java.lang.String name, java.lang.String namespace, org.w3c.dom.Node node)
name
- name of the child elementnamespace
- namespace of the child elementnode
- current element
public static ElementList getChildElementsByName(java.lang.String name, java.lang.String namespace, org.w3c.dom.Node node)
name
- name of the child elementsnamespace
- namespace of the child elementsnode
- current element
public static java.lang.String getStringValue(org.w3c.dom.Node node)
node
- current element
public static java.lang.String getStringValue(java.lang.String name, java.lang.String namespace, org.w3c.dom.Node node, java.lang.String defaultValue)
name
- name of the child elementnamespace
- namespace of the child elementnode
- current elementdefaultValue
- default value if element is missing
public static java.lang.String getRequiredStringValue(java.lang.String name, java.lang.String namespace, org.w3c.dom.Node node) throws XMLParsingException
name
- name of the child elementnamespace
- namespace of the child elementnode
- current element
XMLParsingException
public static double getDoubleValue(java.lang.String name, java.lang.String namespace, org.w3c.dom.Node node, double defaultValue)
name
- name of the child elementnamespace
- namespace of the child elementnode
- current elementdefaultValue
- value to be used if the specified element is missing
or it's value is not numerical
public static double getRequiredDoubleValue(java.lang.String name, java.lang.String namespace, org.w3c.dom.Node node) throws XMLParsingException
name
- name of the child elementnamespace
- namespace of the child elementnode
- current element
XMLParsingException
- specified child element is missing or the
contained text does not denote a double valuepublic static java.lang.String getAttrValue(java.lang.String name, org.w3c.dom.Node node) throws XMLParsingException
name
- (local) name of attributenode
- current element
XMLParsingException
public static java.lang.String getRequiredAttrValue(java.lang.String name, org.w3c.dom.Node node) throws XMLParsingException
name
- (local) name of attributenode
- current element
XMLParsingException
- if specified attribute is missingpublic static java.lang.String getRequiredAttrValue(java.lang.String name, java.lang.String namespace, org.w3c.dom.Node node) throws XMLParsingException
name
- (local) name of attributenamespace
- namespace of attributenode
- current element
XMLParsingException
- if specified attribute is missingpublic static org.w3c.dom.Document create()
public static java.lang.String getAttrValue(org.w3c.dom.Node node, java.lang.String attrName)
node
- attrName
-
public static java.lang.String getAttrValue(org.w3c.dom.Node node, java.lang.String namespace, java.lang.String attrName)
node
- attrName
-
public static org.w3c.dom.Document parse(java.lang.String fileName) throws java.io.IOException, org.xml.sax.SAXException
fileName
- the filename of the XML file to be parsed
java.io.IOException
org.xml.sax.SAXException
public static org.w3c.dom.Document parse(java.io.Reader reader) throws java.io.IOException, org.xml.sax.SAXException
reader
- accessing the resource to parse
java.io.IOException
org.xml.sax.SAXException
public static org.w3c.dom.Node copyNode(org.w3c.dom.Node source, org.w3c.dom.Node dest)
public static org.w3c.dom.Node insertNodeInto(org.w3c.dom.Node source, org.w3c.dom.Node dest)
public static org.w3c.dom.Element getFirstElement(org.w3c.dom.Node node)
public static org.w3c.dom.Node removeNamedChildNodes(org.w3c.dom.Node node, java.lang.String nodeName)
public static org.w3c.dom.Element getNamedChild(org.w3c.dom.Node node, java.lang.String name)
public static org.w3c.dom.Element getNamedChild(org.w3c.dom.Node node, java.lang.String namespace, java.lang.String name)
public static org.w3c.dom.Document mergeSchemas(org.w3c.dom.Document[] schemas) throws java.lang.Exception
java.lang.Exception
public static java.lang.String getValue(org.w3c.dom.Node node)
public static ElementList getChildElements(org.w3c.dom.Node node)
public static void appendNode(org.w3c.dom.Node node, java.lang.String indent, java.lang.StringBuffer sb)
public static java.lang.String toLocalName(java.lang.String nodeName)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |