I have developed the method which will give you true as a result if expected element value length is present in the XPath of XML file. If that expected element value length is not present in xpath of xml file then it will give false as a result.
User has to give parameters as xpathvalue , xml file path , expected element value length in the method.
Create a class library in which put this code snippet and call whenever it is required.
public bool Match_element_value_length (string user_defined_xpath, string user_defined_xml_file, string user_defined_expected_length)
bool result_val = false;
XmlDocument user_defined_xml_doc = new XmlDocument();
XmlNodeList my_nodeList = user_defined_xml_doc.SelectNodes(user_defined_xpath);
foreach (XmlNode my_node in my_nodeList)
if (Convert.ToString(my_node.InnerText.Length) == user_defined_expected_length)
result_val = true;
result_val = false;
No responses found. Be the first to comment...