I have particular value which is passed to a method ( which also takes an xmldocument as an argument) and the method needs to verify if the value (which has the node path) is in fact part of the xml file which the xml document represents.
So for example if the method were like this
public bool HasValidNodePath(string nodePath, XmlDocument xdoc)
{
XMlNode xnode = xDoc.SelectSingleNode(nodePath);
return xnode == null? false: true;
}
Now the problem is the nodePath has the following value (with efile as the namespace)
efile:ReturnState/efile:ReturnDataState/efile:processBO/composition/forms/IT204CP
and the xmlDocument representing the xml file does not have this name space efile.
So it always returns false, but if I were to pass just
ReturnState/ReturnDataState/processBO/composition/forms/IT204CP
it returns true.
So, is there any method in xmlHelper or XmlDocumentQuery class where i can ignore the namespace in the path above and just consider
ReturnState/ReturnDataState/processBO/composition/forms/IT204CP
and look for this nodepath (as shown above with out efile) and validate it ?
I am looking for a generic method to replace the namespaces as the nodePath being passed to the method can have any namespace in it.