Solved

Function: substring in MSXML 3.0

Posted on 2003-11-26
1
526 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

635 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