|
From: Rich N. <rne...@ae...> - 2009-04-03 20:24:58
|
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
|