Solved

Function: substring in MSXML 3.0

Posted on 2003-11-26
1
516 Views
Last Modified: 2012-05-04
Hi,

I need an xpath query to extract nodes based on a given month and year.  The following code snippet works fine in MSXML4, but errors with unknown method in MSXML3.  I have checked the MS website and substring is supported in version 3 of MSXML.

Unfortunately, I must use MSXML3.  Can anyone assist?

Thanks
XML
<PageData>
 <Data>
  <Date>2003/11/06</Date>
  <Subject>Test</Subject>
  <Detail>uiouio</Detail>
 </Data>
</PageData>
XPath Query
xxx.SelectNodes("PageData[Data[Date[substring(.,1,7) =" & Chr(34) & Year(dtCurViewMonth) & "/" & Month(dtCurViewMonth) & Chr(34) & "]]]")
0
Comment
Question by:TopCat_UK
1 Comment
 
LVL 26

Accepted Solution

by:
rdcpro earned 250 total points
ID: 9826084
MSXML 3 defaults to the old XSL Patterns language, for backwards compatibility reasons.  You must specify XPath as the selection language after you instantiate the parser:


In JScript:

var xmlDoc = new ActiveXObject("Msxml2.DomDocument");
xmlDoc.setProperty("SelectionLanguage", "XPath");
// set other options here


Regards,
Mike Sharp
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Custom Ribbon doesn't refresh 7 90
XSL-FO - show results in 2 columns 5 32
Create XML 5 49
PowerShell script to remove string in xml file 8 21
The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question