Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XPath -VBA (MSXML2 parses won't execute some Xpath strings) - no current context?

From: redryderridesagain@-------.--- (--- -----)
To: NULL
Date: 12/1/2004 4:51:00 PM
Initially, I tried to execute an XPath query with the selection
language attribute not specifically set to XPath. (commented out) The
result was that the XPath expression was flagged in parsing;

     Expected token 'EOF' found ":" child -->:<-- :advance

Set the selection language attribute with a call???. The selection
line execute, however, the list is empty. XPath selections which do
not depend on the current node such as "//*" appear to work.

A related question is how does one set the current node explicitly?

I am using Word VBA (VB 6.3) with the MSXML 4.0 Service Pack 2
(Microsoft Core Services) installed.

A listing of the data structure and program stub below.

Thanks for any help you can give.


<wrapper>
     <project>
          <advance>
               Solved a fundamental problem
          </advance>
          <uncertainty>
               Several alternatives, 
          </uncertainty>
          <content>
               <step>
                    First tried this.
               </step>
               <step>
                    Second tried this.
               </step>
               <step>
                    Third tried this.
               </step>
          </content>
     </project>
     <project>
          <advance>
               Solved a fundamental problem
          </advance>
          <uncertainty>
               Several alternatives, 
          </uncertainty>
          <content>
               <step>
                    First tried this.
               </step>
               <step>
                    Second tried this.
               </step>
               <step>
                    Third tried this.
               </step>
          </content>
     </project>
</wrapper>

Sub reportHTML(xmldoc As MSXML2.DOMDocument40)
    Dim elemlist As IXMLDOMNodeList, sublist As IXMLDOMNodeList

    Call xmldoc.setProperty("SelectionLanguage", "XPath")
    'xmldoc.setProperty("SelectionLanguage","XPath") ' Gives syntax
errors
    '
    ' For all projects
    '
    Set elemlist = xmldoc.SelectNodes("//project")
    For i = 0 To (elemlist.Length - 1)

        MsgBox ("hi fm the top " & elemlist.Item(i).nodeName)
        Set sublist = xmldoc.SelectNodes("child::advance")
        Call xSection(xmldoc, sublist)
        ...
        Next
End Sub


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent