com.yworks.yfiles.server.graphml.support
Class XmlSupport

java.lang.Object
  extended bycom.yworks.yfiles.server.graphml.support.XmlSupport

public class XmlSupport
extends java.lang.Object

Support classes for handling xml elements.


Method Summary
static java.lang.String getAttributeValue(org.w3c.dom.Node node, java.lang.String attributeName)
          Returns the value of an attribute
static org.w3c.dom.Node getChildNode(org.w3c.dom.Node node, java.lang.String name, java.lang.String namespace)
          Returns a child element of the given node.
static org.w3c.dom.Node[] getChildNodes(org.w3c.dom.Node node, java.lang.String name, java.lang.String namespace)
          Returns all child elements of the given node with the given name and namespace.
static org.w3c.dom.Node getFirstChildElement(org.w3c.dom.Node node)
          Returns the first child node of the given node that is of type Node.ELEMENT_NODE.
static java.lang.String getTextContext(org.w3c.dom.Node node)
          Returns the node value of the first child of the given node that is of type Node.TEXT_NODE or of type Node.CDATA_SECTION_NODE.
static java.lang.String lookupNamespaceURI(org.w3c.dom.Node xmlNode, java.lang.String lookupPrefix)
           
static void setAttribute(org.w3c.dom.Node node, java.lang.String attributeName, java.lang.String value)
          Sets the value of an existing attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setAttribute

public static void setAttribute(org.w3c.dom.Node node,
                                java.lang.String attributeName,
                                java.lang.String value)
Sets the value of an existing attribute.

Parameters:
node - The node to set the attribute for
attributeName - The name of the attribute
value - The new attribute value

getTextContext

public static java.lang.String getTextContext(org.w3c.dom.Node node)
Returns the node value of the first child of the given node that is of type Node.TEXT_NODE or of type Node.CDATA_SECTION_NODE. Returns an empty string, if no such node exists.


getAttributeValue

public static java.lang.String getAttributeValue(org.w3c.dom.Node node,
                                                 java.lang.String attributeName)
Returns the value of an attribute

Parameters:
node - The node to return the attribute value for
attributeName - The name of the attribute
Returns:
The attribute value, or null, if the attribute does not exist.

getChildNode

public static org.w3c.dom.Node getChildNode(org.w3c.dom.Node node,
                                            java.lang.String name,
                                            java.lang.String namespace)
Returns a child element of the given node.

Parameters:
node - The parent node
name - The name of the child node
namespace - The child node's namespace.
Returns:
The child element, or null, if no child element with the given name and namespace exists.

getFirstChildElement

public static org.w3c.dom.Node getFirstChildElement(org.w3c.dom.Node node)
Returns the first child node of the given node that is of type Node.ELEMENT_NODE.

Parameters:
node - The parent node.
Returns:
The first child element, or null, if the given node has no child elements.

getChildNodes

public static org.w3c.dom.Node[] getChildNodes(org.w3c.dom.Node node,
                                               java.lang.String name,
                                               java.lang.String namespace)
Returns all child elements of the given node with the given name and namespace.

Parameters:
node - The parent node
name - The name of the children
namespace - The children's namespace.
Returns:
A possibly empty array of child elements

lookupNamespaceURI

public static java.lang.String lookupNamespaceURI(org.w3c.dom.Node xmlNode,
                                                  java.lang.String lookupPrefix)


Copyright © 2000-2013 yWorks GmbH. All rights reserved