org.jenkinsci.plugins.neoload_integration.supporting
Class XMLUtilities

java.lang.Object
  extended by org.jenkinsci.plugins.neoload_integration.supporting.XMLUtilities
All Implemented Interfaces:
java.io.Serializable

public final class XMLUtilities
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Method Summary
static org.w3c.dom.Node createNodeFromText(java.lang.String xmlText)
          Create an xml Node using the passed in text.
static java.util.List<org.w3c.dom.Node> findByExpression(java.lang.String expression, org.w3c.dom.Node searchNode)
          Return all nodes matching the passed in expression.
static org.w3c.dom.Node findFirstByExpression(java.lang.String expression, org.w3c.dom.Node searchNode)
          Return the first node matching the passed in expression or null if none was found.
static java.util.Map<java.lang.String,java.lang.String> getMap(org.w3c.dom.NamedNodeMap attributes)
           
static org.w3c.dom.Document readXmlFile(java.lang.String srcFile)
          Read an xml file.
static java.util.List<org.w3c.dom.Node> toList(org.w3c.dom.NodeList nodeList)
          Turns a NodeList into a list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createNodeFromText

public static org.w3c.dom.Node createNodeFromText(java.lang.String xmlText)
                                           throws javax.xml.parsers.ParserConfigurationException,
                                                  org.xml.sax.SAXException,
                                                  java.io.IOException
Create an xml Node using the passed in text. Use getOwnerDocument() to get the document.

Parameters:
xmlText -
Returns:
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

findByExpression

public static java.util.List<org.w3c.dom.Node> findByExpression(java.lang.String expression,
                                                                org.w3c.dom.Node searchNode)
                                                         throws javax.xml.xpath.XPathExpressionException
Return all nodes matching the passed in expression. Useful path expressions are listed below:
Expression Description
nodename Selects all nodes with the name "nodename"
/ Selects from the root node
// Selects nodes in the document from the current node that match the selection no matter where they are
. Selects the current node
.. Selects the parent of the current node
@ Selects attributes

Parameters:
expression - search for this expression
nodes - search this and all child nodes
Returns:
Throws:
javax.xml.xpath.XPathExpressionException

findFirstByExpression

public static org.w3c.dom.Node findFirstByExpression(java.lang.String expression,
                                                     org.w3c.dom.Node searchNode)
                                              throws javax.xml.xpath.XPathExpressionException
Return the first node matching the passed in expression or null if none was found.

Parameters:
expression -
searchNode -
Returns:
Throws:
javax.xml.xpath.XPathExpressionException

getMap

public static java.util.Map<java.lang.String,java.lang.String> getMap(org.w3c.dom.NamedNodeMap attributes)
Parameters:
attributes -
Returns:
a map where the attribute is the key and the value is the value.

toList

public static java.util.List<org.w3c.dom.Node> toList(org.w3c.dom.NodeList nodeList)
Turns a NodeList into a list.

Parameters:
nodeList -
Returns:

readXmlFile

public static org.w3c.dom.Document readXmlFile(java.lang.String srcFile)
                                        throws javax.xml.parsers.ParserConfigurationException,
                                               org.xml.sax.SAXException,
                                               java.io.IOException
Read an xml file.

Parameters:
srcFile -
Returns:
a document created from the passed in file path
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException


Copyright © 2004-2014. All Rights Reserved.