Solved

Function: substring in MSXML 3.0

Posted on 2003-11-26
1
511 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now