ChrisRChamberlain
Programmer
Hi all
It appears that VFP may have a problem evaluating XPath expressions and I hope someone will prove otherwise.
The line of code in question is
which should return a subset of nodes in accordance with the filter expression.
The following code snippit to be found at XStandard.com
The VFP code is
It appears that VFP cannot evaluate this particular expression, the error reported is 'Expression evaluator failed (Error 67)', and you get the same results even if you reduce the expression to something as minimal as ("//TITLE").
Tried all the available combinations of string delimiters and building strings using the VFP CHR() functions without success, even using simple expressions as posted.
TIA
![[pc2] [pc2] [pc2]](/data/assets/smilies/pc2.gif)
PDFcommandertm.net
PDFcommandertm.co.uk
It appears that VFP may have a problem evaluating XPath expressions and I hope someone will prove otherwise.
The line of code in question is
Code:
FOR EACH objNode in objDocSelectNodes("//a[string(@href) != '']"
The following code snippit to be found at XStandard.com
Code:
<%
Dim objHTTP, objDoc, objNode
Set objDoc = Server.CreateObject("MSXML2.DOMDocument.4.0")
objDoc.Async = False
Set objHTTP = Server.CreateObject("XStandard.HTTP")
objHTTP.AddRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)"
objHTTP.Get "[URL unfurl="true"]http://xstandard.com"[/URL]
If objDoc.LoadXML(objHTTP.ResponseAsXML) Then
For Each objNode In objDoc.SelectNodes("//a[string(@href) != '']")
Response.Write "<div>" & objNode.Attributes.GetNamedItem("href").Text & "</div>
Next
Else
Response.Write "Cannot parse response."
End If
Set objHTTP = Nothing
Set objDoc = Nothing
Set objNode = Nothing
%>
Code:
[COLOR=blue]oDoc = CREATEOBJECT([MSXML2.DOMDocument.4.0])
oDoc.Async = .F.
oHTTP = CREATEOBJECT([XStandard.HTTP])
oHTTP.AddRequestHeader([User-agent],[Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)])
oHTTP.Get([[URL unfurl="true"]http://xstandard.com[/URL]])
IF oDoc.LoadXML(oHTTP.ResponseAsXML)
[/color][COLOR=red]FOR EACH objNode IN oDoc.SelectNodes("//a[string(@href) != '']")[/color][COLOR=blue]
WAIT WINDOW objNode.Attributes.GetNamedItem("href").Text
NEXT
ENDI
objNode = .NULL.
oDoc = .NULL.
oHTTP = .NULL.[/color]
Tried all the available combinations of string delimiters and building strings using the VFP CHR() functions without success, even using simple expressions as posted.
TIA
FAQ184-2483 - answering getting answered.
Chris ![[pc2] [pc2] [pc2]](/data/assets/smilies/pc2.gif)
PDFcommandertm.net
PDFcommandertm.co.uk