B
Bruce Sandeman
Hi,
I am trying to execute the following xpath query against my
XmlDocument.
//*[not(*)][count(ancestor::node())=max(//*[not(*)]/
count(ancestor::node()))]
This query will retrieve the deepest node. It only works in XPath 2.0
but according to MS documentation .Net 2.0 supports XPath 2.0 so this
should work in theory....
There is nothing wrong with the query as I can execute it just fine
within OxygenXML but when I use it within my C# code it bounces back
with the error XPathException "...." has an invalid token.
Does anyone know why this could be? or have any ideas of things I
could try?
The code I am using is as follows:
public XPathNodeIterator ExecuteXPathQuery(String query)
{
XPathNavigator nav = xmlDoc.CreateNavigator();
XPathExpression exp = nav.Compile(query);
exp.SetContext(namespaceManager);
XPathNodeIterator xpni =
xmlDoc.CreateNavigator().Select(exp);
return xpni;
}
thanks
Bruce
I am trying to execute the following xpath query against my
XmlDocument.
//*[not(*)][count(ancestor::node())=max(//*[not(*)]/
count(ancestor::node()))]
This query will retrieve the deepest node. It only works in XPath 2.0
but according to MS documentation .Net 2.0 supports XPath 2.0 so this
should work in theory....
There is nothing wrong with the query as I can execute it just fine
within OxygenXML but when I use it within my C# code it bounces back
with the error XPathException "...." has an invalid token.
Does anyone know why this could be? or have any ideas of things I
could try?
The code I am using is as follows:
public XPathNodeIterator ExecuteXPathQuery(String query)
{
XPathNavigator nav = xmlDoc.CreateNavigator();
XPathExpression exp = nav.Compile(query);
exp.SetContext(namespaceManager);
XPathNodeIterator xpni =
xmlDoc.CreateNavigator().Select(exp);
return xpni;
}
thanks
Bruce