当前位置: 首页>>代码示例>>C#>>正文


C# NameTable.Add方法代码示例

本文整理汇总了C#中System.Xml.NameTable.Add方法的典型用法代码示例。如果您正苦于以下问题:C# NameTable.Add方法的具体用法?C# NameTable.Add怎么用?C# NameTable.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.NameTable的用法示例。


在下文中一共展示了NameTable.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateNameTable

 private static XmlNameTable CreateNameTable()
 {
     XmlNameTable table = new System.Xml.NameTable();
     table.Add(string.Empty);
     table.Add("http://www.w3.org/2000/xmlns/");
     table.Add("http://www.w3.org/XML/1998/namespace");
     return table;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XNodeReader.cs

示例2: CreateXmlNameTable

 public static XmlNameTable CreateXmlNameTable(List<ComponentBase> lst)
 {
     //NameTable nameTable = new NameTable();
     //foreach (ComponentBase item in lst)
     //{
     //    nameTable.Add(item.Name);
     //}
     //return nameTable;
     NameTable nt = new NameTable();
     object book = nt.Add("book");
     object price = nt.Add("price");
     return nt;
 }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:13,代码来源:XsltUtils.cs

示例3: CreateXmlNameTable

 public static XmlNameTable CreateXmlNameTable(List<Funclet> lst)
 {
     //NameTable nameTable = new NameTable();
     //foreach (Funclet item in lst)
     //{
     //    nameTable.Add(item.FunctionName);
     //}
     //return nameTable;
     NameTable nt = new NameTable();
     object book = nt.Add("book");
     object price = nt.Add("price");
     return nt;
 }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:13,代码来源:XsltUtils.cs

示例4: Schema

 static Schema() {
     NameTable nt = new NameTable();
     nt.Add(Namespace.Xs.NamespaceName);
     NamespaceManager = new XmlNamespaceManager(nt);
     Swidtag = XDocument.Load(XmlReader.Create(new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("FearTheCowboy.Iso19770.Properties.Swidtag.xsd.xml")), new XmlReaderSettings()));
     NamespaceManager.AddNamespace("xs", Namespace.Xs.NamespaceName);
 }
开发者ID:enavro,项目名称:SwidTag,代码行数:7,代码来源:Schema.cs

示例5: NonValidatingReader

 public NonValidatingReader(string content)
     : base()
 {
     this.content = content;
     _NameTable = new NameTable();
     Namespaces = new Dictionary<string,string>();
     Namespaces.Add(_NameTable.Add("xml"),"http://www.w3.org/XML/1998/namespace");
 }
开发者ID:palfrey,项目名称:pyro,代码行数:8,代码来源:NonValidatingReader.cs

示例6: DynamicContext

		/// <summary>
		/// Initializes a new instance of the <see cref="DynamicContext"/> class.
		/// </summary>
		/// <param name="context">A previously filled context with the namespaces to use.</param>
		/// <param name="table">The NameTable to use.</param>
		public DynamicContext(XmlNamespaceManager context, NameTable table) : base(table)
		{
			object xml = table.Add(XmlNamespaces.Xml);
			object xmlns = table.Add(XmlNamespaces.XmlNs);

			if (context != null)
			{
				foreach (string prefix in context)
				{
					string uri = context.LookupNamespace(prefix);
					// Use fast object reference comparison to omit forbidden namespace declarations.
					if (Object.Equals(uri, xml) || Object.Equals(uri, xmlns))
						continue;

					base.AddNamespace(prefix, uri);
				}
			}
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:23,代码来源:DynamicContext.cs

示例7: CreateAtomNameTable

        private static NameTable CreateAtomNameTable()
        {
            NameTable table = new NameTable();
            table.Add(XmlConstants.AtomNamespace);
            table.Add(XmlConstants.DataWebNamespace);
            table.Add(XmlConstants.DataWebMetadataNamespace);

            table.Add(XmlConstants.AtomContentElementName);
            table.Add(XmlConstants.AtomContentSrcAttributeName);
            table.Add(XmlConstants.AtomEntryElementName);
            table.Add(XmlConstants.AtomETagAttributeName);
            table.Add(XmlConstants.AtomFeedElementName);

            table.Add(XmlConstants.AtomIdElementName);

            table.Add(XmlConstants.AtomInlineElementName);
            table.Add(XmlConstants.AtomLinkElementName);
            table.Add(XmlConstants.AtomLinkRelationAttributeName);
            table.Add(XmlConstants.AtomNullAttributeName);
            table.Add(XmlConstants.AtomPropertiesElementName);
            table.Add(XmlConstants.AtomTitleElementName);
            table.Add(XmlConstants.AtomTypeAttributeName);

            table.Add(XmlConstants.XmlErrorCodeElementName);
            table.Add(XmlConstants.XmlErrorElementName);
            table.Add(XmlConstants.XmlErrorInnerElementName);
            table.Add(XmlConstants.XmlErrorMessageElementName);
            table.Add(XmlConstants.XmlErrorTypeElementName);
            return table;
        }
开发者ID:nlhepler,项目名称:mono,代码行数:30,代码来源:XmlUtil.cs

示例8: ParsePlayerNewNew

        //    may look at the following website for correct parsing of HTML file
        // 	http://stackoverflow.com/questions/8194155/c-sharp-parse-xml-file
        public void ParsePlayerNewNew(ref string cFilePath)
        {
            //	Load document
            NameTable nametable = new NameTable();
            //object html = nametable.Add ("HTML");
            object body = nametable.Add ("body");

            // Create the reader.
            XmlReaderSettings settings = new XmlReaderSettings();
            settings.NameTable = nametable;
            XmlReader reader = XmlReader.Create(cFilePath, settings);

            reader.MoveToContent();
            reader.Skip ();
            reader.ReadToDescendant("body");

            if (System.Object.ReferenceEquals (body, reader.Name)) {
                string innerxml = reader.ReadInnerXml ();
                Console.WriteLine (innerxml);
            }
        }
开发者ID:humeaua,项目名称:CVATools,代码行数:23,代码来源:FileParser.cs

示例9: Main

        public static void Main(String[] args)
        {
            nsmgr = new XmlNamespaceManager(new NameTable());
            nsmgr.AddNamespace("urn", "urn:nhibernate-mapping-2.2");

            children = new ArrayList();
            allMaps = new MultiMap();

            File.Delete("error-log.txt");

            // DOMConfigurator is deprecated in the latest log4net, but we are using an earlier
            // version that comes with NVelocity.
            XmlConfigurator.Configure(new FileInfo("NHibernate.Tool.hbm2net.exe.config"));

            if (args.Length == 0)
            {
                Console.Error.WriteLine("No arguments provided. Nothing to do. Exit.");
                Environment.Exit(- 1);
            }

            ArrayList mappingFiles = new ArrayList();
            string outputDir = null;
            SupportClass.ListCollectionSupport generators = new SupportClass.ListCollectionSupport();

            MultiMap globalMetas = new MultiHashMap();
            // parse command line parameters
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].StartsWith("--"))
                {
                    if (args[i].StartsWith("--config="))
                    {
                        FileInfo configFile = new FileInfo(args[i].Substring(9));

                        // parse config xml file
                        Document document = new XmlDocument();
                        document.Load(configFile.FullName);
                        globalMetas = MetaAttributeHelper.LoadAndMergeMetaMap((document["codegen"]), null);
                        IEnumerator generateElements = document["codegen"].SelectNodes("generate").GetEnumerator();

                        while (generateElements.MoveNext())
                        {
                            generators.Add(new Generator(configFile.Directory, (Element) generateElements.Current));
                        }
                    }
                    else if (args[i].StartsWith("--output="))
                    {
                        outputDir = args[i].Substring(9);
                    }
                }
                else if (args[i].IndexOf("*") > -1)
                {
                    // Handle wildcards
                    mappingFiles.AddRange(GetFiles(args[i]));
                }
                else
                {
                    mappingFiles.Add(args[i]);
                }
            }

            // if no config xml file, add a default generator
            if (generators.Count == 0)
            {
                generators.Add(new Generator(new DirectoryInfo(Environment.CurrentDirectory)));
            }

            Hashtable classMappings = new Hashtable();
            for (IEnumerator iter = mappingFiles.GetEnumerator(); iter.MoveNext(); )
            {
                log.Info(iter.Current.ToString());

                string mappingFile = (string)iter.Current;
                if (!Path.IsPathRooted(mappingFile))
                {
                    mappingFile = Path.Combine(Environment.CurrentDirectory, mappingFile);
                }
                if (!File.Exists(mappingFile))
                    throw new FileNotFoundException("Mapping file does not exist.", mappingFile);

                // parse the mapping file
                NameTable nt = new NameTable();
                nt.Add("urn:nhibernate-mapping-2.2");
                Document document = new XmlDocument(nt);
                document.Load(mappingFile);

                Element rootElement = document["hibernate-mapping"];

                if (rootElement == null)
                    continue;

                XmlAttribute a = rootElement.Attributes["namespace"];
                string pkg = null;
                if (a != null)
                {
                    pkg = a.Value;
                }
                MappingElement me = new MappingElement(rootElement, null);
                IEnumerator classElements = rootElement.SelectNodes("urn:class", nsmgr).GetEnumerator();
                MultiMap mm = MetaAttributeHelper.LoadAndMergeMetaMap(rootElement, globalMetas);
//.........这里部分代码省略.........
开发者ID:mpielikis,项目名称:nhibernate-contrib,代码行数:101,代码来源:CodeGenerator.cs

示例10: PathNode

 /// <summary>
 /// Initializes a new instance of the <see cref="PathNode"/> class.
 /// </summary>
 /// <param name="elementNsUri">The namespace URI of the element-node</param>
 /// <param name="elementNodeName">The local name of the element-node</param>
 /// <param name="nameTable">A NameTable for storing namespace URI and local name</param>
 internal PathNode(string elementNsUri, string elementNodeName, NameTable nameTable)
 {
     _XmlElementNsUri = nameTable.Add(elementNsUri);
     _XmlElementNodeName = nameTable.Add(elementNodeName);
 }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:11,代码来源:PathNode.cs

示例11: CheckXmlMapping

        private void CheckXmlMapping(string hbm,params string[] stream)
        {
            NameTable nt = new NameTable();
            nt.Add("urn:nhibernate-mapping-2.2");
            var nsmgr = new XmlNamespaceManager(nt);
            nsmgr.AddNamespace("urn", "urn:nhibernate-mapping-2.2");
            XmlDocument doc = new XmlDocument(nt);
            doc.PreserveWhitespace = true;
            doc.LoadXml(internalStreams[stream[0]].ToString());
            XmlNode refChild = doc.SelectSingleNode("//urn:class",nsmgr);
            for (int i = 1; i < stream.Length; ++i)
            {
                XmlDocument docChild = new XmlDocument(nt);
                docChild.PreserveWhitespace = true;
                docChild.LoadXml(internalStreams[stream[i]].ToString());
                doc.SelectSingleNode("/urn:hibernate-mapping",nsmgr).AppendChild(doc.ImportNode(docChild.SelectSingleNode("//urn:class",nsmgr),true));
            }
            DiffConfiguration dc = new DiffConfiguration("test", true, WhitespaceHandling.None, true);
            XmlDiff diff = new XmlDiff(new XmlInput(doc.OuterXml)
                                       , new XmlInput(ResourceHelper.GetResource(hbm))
                                       ,dc
                                       );
            var res = diff.Compare();
            if (!res.Equal)
            {
                Console.WriteLine("Expected xml was:");
                Console.WriteLine(ResourceHelper.GetResource(hbm));
                Console.WriteLine("But was:");
                Console.WriteLine(doc.InnerXml);

            }
            Assert.IsTrue(res.Equal);
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:33,代码来源:Db2hbmTest.cs

示例12: GeometryGmlWriterTest

        private static void GeometryGmlWriterTest(Action<GeometryPipeline> pipelineCalls, params string[] expectedXPaths)
        {
            var ms = new MemoryStream();
            var w = XmlWriter.Create(ms, new XmlWriterSettings { Indent = false });
            DrawBoth gw = new GmlWriter(w);
            gw.GeometryPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeometry);

            pipelineCalls(gw.GeometryPipeline);
            w.Flush();
            w.Close();

            // use XElement to validate basic XML integrity
            ms.Seek(0, SeekOrigin.Begin);
            XmlNameTable nt = new NameTable();
            nt.Add(GmlConstants.GmlPrefix);
            // XPath or string contains
            var xnm = new XmlNamespaceManager(nt);
            xnm.AddNamespace(GmlConstants.GmlPrefix, GmlConstants.GmlNamespace);

            var xDoc = new XmlDocument(nt);
            xDoc.Load(ms);

            var nav = xDoc.CreateNavigator();
            SpatialTestUtils.VerifyXPaths(nav, xnm, "/node()[@gml:srsName = '" + GmlConstants.SrsPrefix + CoordinateSystem.DefaultGeometry.EpsgId + "']");

            SpatialTestUtils.VerifyXPaths(nav, xnm, expectedXPaths);
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:27,代码来源:GmlWriterTests.cs

示例13: CreatePrimedNametable

        // Creates and initializes the name table if neccessary
        static private XmlNameTable CreatePrimedNametable()
        {
            Util.Log("WsdlParser.CreatePrimedNametable");           

            //Interlocked.Increment(ref s_counter);
            /*if(s_atomizedTable == null)
            {
            // Create a new nametable
            //MTNameTable newTable = new MTNameTable(true);
            }*/
            NameTable newTable = new NameTable();

            // Atomically update static location to point to the current table
            /*Object oldTable = Interlocked.CompareExchange(ref s_atomizedTable, newTable, null);
            if(oldTable != null)
            newTable = (MTNameTable) oldTable; */

            // Atomize frequently used strings for perf
            // The following ops are not done inside a lock as they are idempotent
            s_emptyString = newTable.Add(String.Empty);
            s_complexTypeString = newTable.Add("complexType");
            s_simpleTypeString = newTable.Add("simpleType");
            s_elementString = newTable.Add("element");
            s_enumerationString = newTable.Add("enumeration");
            s_encodingString = newTable.Add("encoding");
            s_attributeString = newTable.Add("attribute");
            s_attributesString = newTable.Add("attributes");
            s_allString = newTable.Add("all");
            s_sequenceString = newTable.Add("sequence");
            s_choiceString = newTable.Add("choice");
            s_minOccursString = newTable.Add("minOccurs");
            s_maxOccursString = newTable.Add("maxOccurs");
            s_unboundedString = newTable.Add("unbounded");
            s_oneString = newTable.Add("1");
            s_zeroString = newTable.Add("0");
            s_nameString = newTable.Add("name");
            s_typeString = newTable.Add("type");
            s_baseString = newTable.Add("base");
            s_valueString = newTable.Add("value");
            s_interfaceString = newTable.Add("interface");
            s_serviceString = newTable.Add("service");
            s_extendsString = newTable.Add("extends");
            s_addressesString = newTable.Add("addresses");
            s_addressString = newTable.Add("address");
            s_uriString = newTable.Add("uri");
            s_implementsString = newTable.Add("implements");
            s_nestedTypeString = newTable.Add("nestedType");
            s_requestString = newTable.Add("request");
            s_responseString = newTable.Add("response");
            s_requestResponseString = newTable.Add("requestResponse");
            s_messageString = newTable.Add("message");
            s_locationString = newTable.Add("location");
            s_schemaLocationString = newTable.Add("schemaLocation");
            s_importString = newTable.Add("import");
            s_onewayString = newTable.Add("oneway");
            s_includeString = newTable.Add("include");
            s_refString = newTable.Add("ref");
            s_refTypeString = newTable.Add("refType");
            s_referenceString = newTable.Add("Reference");
            s_objectString = newTable.Add("Object");
            s_urTypeString = newTable.Add("anyType");
            s_arrayString = newTable.Add("Array");
            s_sudsString = newTable.Add("suds");
            s_methodString = newTable.Add("method");
            s_useString = newTable.Add("use");
            s_rootTypeString = newTable.Add("rootType");
            s_soapString = newTable.Add("soap");
            s_serviceDescString = newTable.Add("serviceDescription");
            s_schemaString = newTable.Add("schema");
            s_targetNamespaceString = newTable.Add("targetNamespace");
            s_namespaceString = newTable.Add("namespace");
            s_idString = newTable.Add("ID");
            s_soapActionString = newTable.Add("soapAction");
            s_schemaNamespaceString1999 = newTable.Add(SudsConverter.Xsd1999);
            s_instanceNamespaceString1999 = newTable.Add(SudsConverter.Xsi1999);
            s_schemaNamespaceString2000 = newTable.Add(SudsConverter.Xsd2000);
            s_instanceNamespaceString2000 = newTable.Add(SudsConverter.Xsi2000);
            s_schemaNamespaceString = newTable.Add(SudsConverter.Xsd2001);
            s_instanceNamespaceString = newTable.Add(SudsConverter.Xsi2001);
            s_soapNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:soap.v1");
            //s_sudsNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:suds.v1");
            s_sudsNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:soap-sdl-2000-01-25");
            //s_URTNamespaceString = newTable.Add("urn:schamas-xmlsoap-org:urt.v1");
            //s_serviceNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:servicedesc.v1");
            s_serviceNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:sdl.2000-01-25");

            // Wsdl strings
            s_definitionsString = newTable.Add("definitions");
            s_wsdlNamespaceString = newTable.Add("http://schemas.xmlsoap.org/wsdl/");
            s_wsdlSoapNamespaceString = newTable.Add("http://schemas.xmlsoap.org/wsdl/soap/");
            s_wsdlSudsNamespaceString = newTable.Add("http://www.w3.org/2000/wsdl/suds");
            s_enumTypeString = newTable.Add("enumType");
            s_typesString = newTable.Add("types");
            s_partString = newTable.Add("part");
            s_portTypeString = newTable.Add("portType");
            s_operationString = newTable.Add("operation");
            s_inputString = newTable.Add("input");
            s_outputString = newTable.Add("output");
            s_bindingString = newTable.Add("binding");
//.........这里部分代码省略.........
开发者ID:JianwenSun,项目名称:cc,代码行数:101,代码来源:WsdlParser.cs

示例14: CreateNameTable

 public void CreateNameTable()
 {
     NameTable nt = new NameTable();
     nt.Add("Root");
 }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:5,代码来源:FrmItem.cs

示例15: FortifyStrings_ContainsCorrectStrings

 public void FortifyStrings_ContainsCorrectStrings()
 {
     var nameTable = new NameTable();
     var uut = new FortifyStrings(nameTable);
     Assert.AreSame(nameTable.Add("Issue"), uut.Issue);
     Assert.AreSame(nameTable.Add("iid"), uut.Iid);
     Assert.AreSame(nameTable.Add("ruleID"), uut.RuleId);
     Assert.AreSame(nameTable.Add("Category"), uut.Category);
     Assert.AreSame(nameTable.Add("Folder"), uut.Folder);
     Assert.AreSame(nameTable.Add("Kingdom"), uut.Kingdom);
     Assert.AreSame(nameTable.Add("Abstract"), uut.Abstract);
     Assert.AreSame(nameTable.Add("AbstractCustom"), uut.AbstractCustom);
     Assert.AreSame(nameTable.Add("Friority"), uut.Friority);
     Assert.AreSame(nameTable.Add("Tag"), uut.Tag);
     Assert.AreSame(nameTable.Add("Comment"), uut.Comment);
     Assert.AreSame(nameTable.Add("Primary"), uut.Primary);
     Assert.AreSame(nameTable.Add("Source"), uut.Source);
     Assert.AreSame(nameTable.Add("TraceDiagramPath"), uut.TraceDiagramPath);
     Assert.AreSame(nameTable.Add("ExternalCategory"), uut.ExternalCategory);
     Assert.AreSame(nameTable.Add("type"), uut.Type);
     Assert.AreSame(nameTable.Add("FileName"), uut.FileName);
     Assert.AreSame(nameTable.Add("FilePath"), uut.FilePath);
     Assert.AreSame(nameTable.Add("LineStart"), uut.LineStart);
     Assert.AreSame(nameTable.Add("Snippet"), uut.Snippet);
     Assert.AreSame(nameTable.Add("SnippetLine"), uut.SnippetLine);
     Assert.AreSame(nameTable.Add("TargetFunction"), uut.TargetFunction);
 }
开发者ID:Microsoft,项目名称:sarif-sdk,代码行数:27,代码来源:FortifyStringsTests.cs


注:本文中的System.Xml.NameTable.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。