Figaro - The XML Database for the .NET Framework

In order for you to use a namespace prefix in your query, you must first declare that namespace to Figaro. When you do this, you must identify the URI that corresponds to the prefix, and this URI must match the URI in use on your documents.

You can declare as many namespaces as are needed for your query.

To declare a namespace, use SetNamespace. For example:

CopyC#
using (var mgr = new XmlManager { DefaultContainerType = XmlContainerType.WholeDocContainer })
{
    if (mgr.ExistsContainer(testdb))
        mgr.RemoveContainer(testdb);
    using (var cont = mgr.CreateContainer(testdb))
    {
        //create the query context
        var queryContext = mgr.CreateQueryContext(EvaluationType.Lazy);
        //set some namespace values
        queryContext.SetNamespace("fruits", "http://groceryItem.dbxml/fruits");
        queryContext.SetNamespace("vegetables", "http://groceryItem.bdbxml/vegetables");
        //ALWAYS close your container!
        cont.Close();
    }
}