This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > February 2005 > Unknown Method error using count function





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Unknown Method error using count function
Jerry West

2005-02-24, 6:38 pm

<Test>
<Order id="1">
<Key/>
<Key/>
</Order>
<Order id="2">
<Key>
</Order>
</Test>

I am attempting to select the Order Nodes which have two or more key
Elements. I am using MSXML3. I have this set in VB6 Project References. I am
using the following to make this selection:

Dim sQuery As String

Dim ElemList As IXMLDOMNodeList

Dim XML As New MSXML2.FreeThreadedDOMDocument

sQuery$ = "//Order[count(Key) >= 2]"

Set ElemList = xml.selectNodes(sQuery$)

This generates an error which indicates "Unknown Method" -->count(Key<--

When I look at the Err.Source object I see msxml3.dll is properly
represented. When I check the table of listed functions I see the count
function is applicable to msxml3.dll which I have selected for use in the
Project References of VB6. I then tried again on three different computers
all of which have msxml3.dll installed and all yield the same error.

Is this function proper for msxml3? If so, have I done something wrong above
that would cause the error?

JW


Martin Honnen

2005-02-24, 6:38 pm



Jerry West wrote:


> I am attempting to select the Order Nodes which have two or more key
> Elements. I am using MSXML3. I have this set in VB6 Project References. I am
> using the following to make this selection:
>
> Dim sQuery As String
>
> Dim ElemList As IXMLDOMNodeList
>
> Dim XML As New MSXML2.FreeThreadedDOMDocument
>
> sQuery$ = "//Order[count(Key) >= 2]"
>
> Set ElemList = xml.selectNodes(sQuery$)
>
> This generates an error which indicates "Unknown Method" -->count(Key<--


Do
xml.setProperty "SelectionLanguage", "XPath"
before you use selectNodes, MSXML 3 supports XPath 1.0 only if you set
that property before calling selectNodes/selectSingleNode.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jerry West

2005-02-24, 6:38 pm

Thank you, that was indeed the issue.

JW

"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:u3esjupGFHA.2936@TK2MSFTNGP15.phx.gbl...
>
>
> Jerry West wrote:
>
>
>
> Do
> xml.setProperty "SelectionLanguage", "XPath"
> before you use selectNodes, MSXML 3 supports XPath 1.0 only if you set
> that property before calling selectNodes/selectSingleNode.
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews