Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Function: substring in MSXML 3.0

Posted on 2003-11-26
1
Medium Priority
?
532 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 1000 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

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, …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Integration Management Part 2
Suggested Courses

927 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