Ejemplo n.º 1
0
        private void InitializeCustomContext(CustomQueryContext paramContext)
        {
            IDictionary <string, string> namespaces = paramContext.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml);

            _paramContext = new CustomQueryContext((NameTable)paramContext.NameTable);
            _paramContext.AddNamespace(namespaces);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// This method does some XPath specific initializations.
 /// </summary>
 private void InitializeXPathObjects(Stream xmlStream)
 {
     try
     {
         _xPathDoc     = new XPathDocument(xmlStream);
         _xNav         = _xPathDoc.CreateNavigator();
         _paramContext = new CustomQueryContext(new NameTable());
     }
     catch (XmlException ex)
     {
         Trace.TraceError("An XML specific exception occured " +
                          "while initializing XPathDocument and XPathNavigator in XPathQueryManager: " +
                          ex.Message);
         throw;
     }
     catch (Exception ex)
     {
         Trace.TraceError("An exception occured " +
                          "while initializing XPathDocument and XPathNavigator in XPathQueryManager: " +
                          ex.Message);
         throw;
     }
     finally
     {
         xmlStream.Dispose();
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XPathQueryManager"/> class.
 /// </summary>
 /// <param name="xPathDoc">An XmlDocument instance</param>
 /// <param name="xIter">An XPathNodeIterator instance</param>
 /// <param name="paramContext">A <see cref="XPathQueryManager.CustomQueryContext"/> instance for parameterized XPath expressions</param>
 private XPathQueryManager(XPathDocument xPathDoc, XPathNodeIterator xIter, CustomQueryContext paramContext)
     : this(xPathDoc)
 {
     if (xIter != null)
     {
         _xNav = xIter.Current;
     }
     InitializeCustomContext(paramContext);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XPathQueryManager"/> class.
 /// </summary>
 /// <param name="xPathDoc">An XmlDocument instance</param>
 /// <param name="paramContext">A <see cref="XPathQueryManager.CustomQueryContext"/> instance for parameterized XPath expressions</param>
 private XPathQueryManager(XPathDocument xPathDoc, XPathNavigator xNav, CustomQueryContext paramContext)
 {
     _XNav = xNav.Clone();
     SetDocumentToParse(xPathDoc);
     InitializeCustomContext(paramContext);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XPathQueryManager"/> class.
 /// </summary>
 /// <param name="xPathDoc">An XmlDocument instance</param>
 public XPathQueryManager(XPathDocument xPathDoc)
 {
     SetDocumentToParse(xPathDoc);
     _ParamContext = new CustomQueryContext(new NameTable());
 }
Ejemplo n.º 6
0
 private void InitializeCustomContext(CustomQueryContext paramContext)
 {
     IDictionary<string, string> namespaces = paramContext.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml);
     _ParamContext = new CustomQueryContext((NameTable) paramContext.NameTable);
     _ParamContext.AddNamespace(namespaces);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// This method does some XPath specific initializations.
 /// </summary>
 private void initializeXPathObjects(Stream xmlStream)
 {
     try
     {
         _XPathDoc = new XPathDocument(xmlStream);
         _XNav = _XPathDoc.CreateNavigator();
         _ParamContext = new CustomQueryContext(new NameTable());
     }
     catch (XmlException ex)
     {
         Trace.TraceError("An XML specific exception occured " +
                          "while initializing XPathDocument and XPathNavigator in XPathQueryManager: " +
                          ex.Message);
         throw ex;
     }
     catch (Exception ex)
     {
         Trace.TraceError("An exception occured " +
                          "while initializing XPathDocument and XPathNavigator in XPathQueryManager: " +
                          ex.Message);
         throw ex;
     }
     finally
     {
         xmlStream.Dispose();
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// This method deletes the current namespace context.
 /// </summary>
 public void ResetNamespaces()
 {
     _ParamContext = null;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XPathQueryManager"/> class.
 /// </summary>
 /// <param name="xPathDoc">An XmlDocument instance</param>
 /// <param name="xIter">An XPathNodeIterator instance</param
 /// <param name="paramContext">A <see cref="XPathQueryManager.CustomQueryContext"/> instance for parameterized XPath expressions</param>
 private XPathQueryManager(XPathDocument xPathDoc, XPathNodeIterator xIter, CustomQueryContext paramContext)
     : this(xPathDoc)
 {
     if (xIter != null)
         _XNav = xIter.Current;
     InitializeCustomContext(paramContext);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XPathQueryManager"/> class.
 /// </summary>
 /// <param name="xPathDoc">An XmlDocument instance</param>
 /// <param name="xNav"></param>
 /// <param name="paramContext">A <see cref="XPathQueryManager.CustomQueryContext"/> instance for parameterized XPath expressions</param>
 private XPathQueryManager(XPathDocument xPathDoc, XPathNavigator xNav, CustomQueryContext paramContext)
 {
     _xNav = xNav.Clone();
     SetDocumentToParse(xPathDoc);
     InitializeCustomContext(paramContext);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XPathQueryManager"/> class.
 /// </summary>
 /// <param name="xPathDoc">An XmlDocument instance</param>
 public XPathQueryManager(XPathDocument xPathDoc)
 {
     SetDocumentToParse(xPathDoc);
     _paramContext = new CustomQueryContext(new NameTable());
 }
Ejemplo n.º 12
0
 /// <summary>
 /// This method deletes the current namespace context.
 /// </summary>
 public void ResetNamespaces()
 {
     _paramContext = null;
 }