Web Functional Testing > Function Reference > XML Validation Functions

XML Validation Functions

Tags:  

DescriptionThe XML Validation function can be used to validate any xml file values.

Following are the functions categorized under XML Validation Functions :

Note: To know the appropriate xml expression to be used for xpath in the below functions, please refer to this URL http://javaalmanac.com/egs/org.w3c.dom/xpath_GetChildElem.html

doesNodeContainValue

Function Description:

To check whether the specified node contains  the given value in the XML file.

How to Define:

doesNodeContainValue(xmlfile,expression(xpath))

xml file = Valid XML file path.

xpath = Valid xpath.

Return Value:

0 for Success

1 for Failure

Top


getNodeAttributes

Function Description:

To get the node attributes from the specified XML file.

How to Define:

getNodeAttributes(xmlfile,expression(xpath))

xml file = Valid XML file path.

xmlpath = Valid xpath.

Example:

     result = getTextNodeAttributes("C:/test/QEngineWebTest/xmlvalid/update_conf.xml","/properties/Log/Class")

     You can verify the output of the function by iterating through the returned object.

     for i in range(0,len(result)):
          for j in range(0,len(result[0])):
              displayMessage(result[i][j])

Return Value:

String Array

Top


getNodeCount

Function Description:

To get the node count from the specified XML file.

How to Define:

geNodeCount(xmlfile,expression(xpath))

xml file = Valid XML file path.

xmlpath = Valid xpath.

Return Value:

Integer

Top


getNodeValue

Function Description:

To get the node value from the specified XML file.

How to Define:

getNodeValue(xmlfile,expression(xpath))

xml file = Valid XML file path.

xmlpath = Valid xpath.

Return Value:

String

Top


getNodeValues

Function Description:

To get the node values from the specified XML file.

How to Define:

getNodeValues(xmlfile,expression(xpath))

xml file = Valid XML file path.

xmlpath = Valid xpath.

Example:

     result = getNodeValues("C:/test/QEngineWebTest/xmlvalid/update_conf.xml","/properties/Log/Class")

     You can verify the output of the function by iterating through the returned object.

     for i in range(0,len(result)):
          for j in range(0,len(result[0])):
             displayMessage(result[i][j])

Return Value:

String array

 Top


getTextNodeValues

Function Description:

To get the text node values from the specified XML file

How to Define:

getTextNodeValues(xmlfile,expression(xpath))

xml file = Valid XML file path.

xmlpath = Valid xpath.

Example:

     result = getTextNodeValues("C:/test/QEngineWebTest/xmlvalid/update_conf.xml","/properties/Log/Class")

     You can verify the output of the function by iterating through the returned object.

     for i in range(0,len(result)):
          for j in range(0,len(result[0])):
              displayMessage(result[i][j])

Return Value:

String array

Top


isNodePresent

Function Description:

To check whether the specified node is present in the  XML file.

How to Define:

isNodePresent(xmlfile,expression(xpath))

xml file = xpath.alid XML file path.

xmlpath = Valid xpath.

Return Value:

0 for Success

1 for Failure

Top


isIdentical

Function Description:

To check whether the two XML files has the same set of node values in the same order.

How to Define:

isXMLIdentical(xmlfile,expression(xpath))

xml file = xpath.alid XML file path.

xmlpath = Valid xpath.

Return Value:

0 for Success

1 for Failure

 Top


isSimilar

Function Description:

To check whether the two XML files has the same set of node values wherein the order can differ.

How to Define:

isXMLSimilar(xmlfile,expression(xpath))

xml file = Valid XML file path.

xmlpath = Valid xpath.

Return Value:

0 for Success

1 for Failure

Top


0 Comments  Show recent to old
Post a comment



 RSS of this page

Copyright © 2009, Zoho Corporation. All Rights Reserved.