Hello all. I have a question about XML parsing and xpath. I am extremely new to both so apologies if this is a basic question. I did search the forum and this link on w3schools as well as the MSDN documentation. I was working from (which was extemely helpful). Here is my problem: I can find a specific named node and then get some info from it which I need. However, I am having trouble finding that node with an alternative approach using "contains" to search for any node that contains a subset of the tag name. Here is the problem in code-speak: #Include
#Include
$oXML=ObjCreate("Microsoft.XMLDOM")
$DirInput =@ScriptDir
$FileInput = "in-20120401.xml"
$sXmlFile =$DirInput & "\" & $FileInput
$oXML.load($sXmlFile)
$searchTerm="us-gaap:DeferredRevenueCurrent";
$XmlRootPath = "//"&$searchTerm
;
;LOOKING TO REPLICATE THIS RESULT USING CONTAINS FUNCTION:
;$searchTerm="us-gaap:DeferredRevenueCurrent";
;$XmlRootPath = "//"&$searchTerm
;dim $result2=$oXML.selectNodes($XmlRootPath)
;THE ABOVE WORKS ... BUT I CAN'T "FIND" IT USING CONTAINS as below
dim $result2=$oXML.selectNodes("//*[contains(.,'DeferredRevenueCurrent')]")
func _advancedQuery()
dim $xpathresult
For $xpathresult In $result2
ConsoleWrite($xpathresult.nodeName&@CRLF)
Next
EndFunc
_advancedQuery() I am also attaching the XML file that I am using. Any help anyone could offer would be greatly appreciated. in-20120401.xml