473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Evaluation of Microsoft XPath exstensions ms:utc()

I am trying to evaluate the Microsoft ms:utc() XPath extension in an XPath
expression. When I do, I get an exception that I need an XsltContext. Given
these are microsoft extentions, it seems unlikely that I would need to
implement my own IXsltContextFunction class for microsoft published
functions. Thus I suspect I am missing something. My Code looks as follows:

this.XPathQueryString = this.textBoxQueryString.Text;
XPathDocument xPathDocument = new XPathDocument(this.XmlFileName);
XPathNavigator xPathNavigator = xPathDocument.CreateNavigator();
XPathExpression expression = XPathExpression.Compile(this.XPathQueryString);

XmlNamespaceManager manager = new XmlNamespaceManagexPathNavigator.NameTable);

manager.AddNamespace("ms", "urn:schemas-microsoft-com:xslt");
expression.SetContext(manager);

switch (expression.ReturnType)
{
case XPathResultType.Number:
double d = (double)xPathNavigator.Evaluate(expression);
this.DisplaySimpleResult(d.ToString());
break;

case XPathResultType.NodeSet:
XPathNodeIterator nodeInterator = xPathNavigator.Select(expression);
this.DisplayNodeResult(nodeInterator);
break; ...
Feb 7 '07 #1
1 2769
jerryn wrote:
I am trying to evaluate the Microsoft ms:utc() XPath extension in an XPath
expression. When I do, I get an exception that I need an XsltContext. Given
these are microsoft extentions, it seems unlikely that I would need to
implement my own IXsltContextFunction class for microsoft published
functions. Thus I suspect I am missing something. My Code looks as follows:

this.XPathQueryString = this.textBoxQueryString.Text;
XPathDocument xPathDocument = new XPathDocument(this.XmlFileName);
XPathNavigator xPathNavigator = xPathDocument.CreateNavigator();
XPathExpression expression = XPathExpression.Compile(this.XPathQueryString);

XmlNamespaceManager manager = new XmlNamespaceManagexPathNavigator.NameTable);

manager.AddNamespace("ms", "urn:schemas-microsoft-com:xslt");
expression.SetContext(manager);

switch (expression.ReturnType)
{
case XPathResultType.Number:
double d = (double)xPathNavigator.Evaluate(expression);
this.DisplaySimpleResult(d.ToString());
break;

case XPathResultType.NodeSet:
XPathNodeIterator nodeInterator = xPathNavigator.Select(expression);
this.DisplayNodeResult(nodeInterator);
break; ...

Unfortunately XPathNavigator doesn't support MIcrosoft ms: extention
functions, they are only available in XSLT context.
Take a look at http://www.tkachenko.com/blog/archives/000649.html for a
sample code that you can use to hook those extension functions into
XPathNavigator.

--
Oleg Tkachenko [XML MVP, MCPD]
http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net
Feb 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: webposter | last post by:
Hi, I am looking for information on a data structure (and associated algorithm) to do short-circuit evaluation of boolean expressions and haven't found a single one even after googing for two...
7
by: Brett Edman | last post by:
I created a UTC clock using this: UTCTime = MyTime.ToUniversalTime() Now that we've turned the clocks ahead 1 hour for daylight savings time, the clock is reporting the wrong UTC time. It is...
4
by: Maziar Aflatoun | last post by:
Hi, Can someone please tell me how I can set DateTime to 01/01/1970 (UTC). Doing the following DateTime dt1 = new DateTime(1970, 1,1); Debug.WriteLine("dt1(utc):"+...
4
by: Dan Lewis | last post by:
I've imported a ms access database into a table in a mysql database. The access database contains a field that holds date/time values in 'general date' format. These all show up at 01/01/1970 in...
3
by: henk | last post by:
i have a utc string how can i convert it to utc datetime? is this ok: dim UtcDate as Datetime=Datetime.parse(UtcString)?
7
by: Dick | last post by:
I have a long list of events. I know where each event took place (globally) and when (using the event’s local time). I want to do some comparisons between these date/times. I thought I would...
3
by: Lonifasiko | last post by:
Hi, I want to convert an UTC time to a Date object in Javascript. The UTC time we have is a string that looks like "1160720058.377452373" for example. I've done it in Java but I'm not able...
1
by: Daz | last post by:
Hi everyone. I know this question sounds stupid, but it's been plaguing me, and as I can't seem to find the answer, and can't afford to wait until the end of March for DST to kick into effect, I...
27
by: RobG | last post by:
I was investigating a function to determine whether daylight saving was being observed on a particular date (given the platform's regional settings) and came across a suggestion at merlyn.com to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.