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

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

public class XmlSupport
extends Object

Support classes for handling xml elements.


Method Summary
static String getAttributeValue(Node node, String attributeName)
          Returns the value of an attribute
static Node getChildNode(Node node, String name, String namespace)
          Returns a child element of the given node.
static Node[] getChildNodes(Node node, String name, String namespace)
          Returns all child elements of the given node with the given name and namespace.
static Node getFirstChildElement(Node node)
          Returns the first child node of the given node that is of type Node.ELEMENT_NODE.
static String getTextContext(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 void setAttribute(Node node, String attributeName, 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(Node node,
                                String attributeName,
                                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 String getTextContext(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 null, if no such node exists.


getAttributeValue

public static String getAttributeValue(Node node,
                                       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 Node getChildNode(Node node,
                                String name,
                                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 Node getFirstChildElement(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 Node[] getChildNodes(Node node,
                                   String name,
                                   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


Copyright © 2000-2007 yWorks GmbH. All rights reserved