Well, it's a shame, but looks like it's not supported. We need to modify
AddKey() to allow compiled XPath expressions too.
As a workaround you could use prefix-free expressions:
inav.AddKey("aptKey", @"*[local-name='AirportHeliport' and
namespace-uri='aixm namespace']/*[local-name='identifier' and
namespace-uri='gml namespace']", ".");
--
Oleg
Rich Neidballa wrote:
>
> Hello:
>
> I would really like to use the Mvp.Xml for a project I am on, but am
> having some difficulty. I have gotten the examples off of MSDN to
> work, but can’t seem to get it to work with the types of XML files I
> am dealing with. The XML have various namespaces and prefixes for
> elements and attributes. The problem occurs when I call the
> “.BuildIndexes()” method. Here’s the code fragment:
>
> public static void SelectFromIndexingXPathNavigator(XPathNavigator nav)
>
> {
>
> XmlNamespaceManager xmln = GetNamespaceMgr(nav.NameTable);
>
> IndexingXPathNavigator inav = new IndexingXPathNavigator(nav);
>
> //inav.AddKey("orderKey", "orders", "@OrderID");
>
> inav.AddKey("aptKey", @"//aixm:AirportHeliport/gml:identifier",
> "gml:identifier");
>
> string test = "key('aptKey', '2443')";
>
> inav.BuildIndexes(); // ß-----Error here
>
> XPathNodeIterator order = inav.Select(test);
>
> //Check if the order was selected
>
> if (!order.MoveNext())
>
> throw new InvalidOperationException("Airport not found.");
>
> }
>
> I get an error as follows:
>
> “Namespace Manager or XsltContext needed. This query has a prefix,
> variable, or user-defined function.”
>
> I don’t see a way to get the Namespace Manager into the
> IndexingXPathNavigator class for the BuildIndexes() method?
>
> Thanks.
>
> *Rich Neidballa*
>
> */Senior Developer/*
>
> */AeroNavData, Inc./*
>
> 1839 Ghent Road Suite 230
>
> Columbia, IL 62236 USA
>
> Phone: 618-281-8986
>
> Fax: 618-281-8558
>
> rne...@ae...
>
> www.aeronavdata.com
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> mvp-xml-help mailing list
> mvp...@li...
> https://lists.sourceforge.net/lists/listinfo/mvp-xml-help
>
|