The Labs \ Source Viewer \ SSCLI \ System.Xml \ XmlImplementation

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlImplementation.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. using System.Globalization;
  16. namespace System.Xml
  17. {
  18.    
  19.     // Provides methods for performing operations that are independent of any
  20.     // particular instance of the document object model.
  21.     public class XmlImplementation
  22.     {
  23.        
  24.         private XmlNameTable nameTable;
  25.        
  26.         // Initializes a new instance of the XmlImplementation class.
  27.         public XmlImplementation() : this(new NameTable())
  28.         {
  29.         }
  30.        
  31.         public XmlImplementation(XmlNameTable nt)
  32.         {
  33.             nameTable = nt;
  34.         }
  35.        
  36.         // Test if the DOM implementation implements a specific feature.
  37.         public bool HasFeature(string strFeature, string strVersion)
  38.         {
  39.             if (String.Compare("XML", strFeature, StringComparison.OrdinalIgnoreCase) == 0) {
  40.                 if (strVersion == null || strVersion == "1.0" || strVersion == "2.0")
  41.                     return true;
  42.             }
  43.             return false;
  44.         }
  45.        
  46.         // Creates a new XmlDocument. All documents created from the same
  47.         // XmlImplementation object share the same name table.
  48.         public virtual XmlDocument CreateDocument()
  49.         {
  50.             return new XmlDocument(this);
  51.         }
  52.        
  53.         internal XmlNameTable NameTable {
  54.             get { return nameTable; }
  55.         }
  56.     }
  57. }

Developer Fusion