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


C# Xml.NameTable类代码示例

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


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

示例1: RenderComponentFieldAsBBCode

        public string RenderComponentFieldAsBBCode(string fieldExpression, int fieldIndex, bool outputImages)
        {
            BuiltInFunctions functions = new BuiltInFunctions(_engine, _package);
            string output = functions.RenderComponentField(fieldExpression, fieldIndex);

            StringReader sr = new StringReader(output);
            NameTable nt = new NameTable();
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
            nsmgr.AddNamespace("tcdl", Tridion.ContentManager.Templating.TcdlTags.TcdlNamespace);
            XmlParserContext parserContext = new XmlParserContext(null, nsmgr, null, XmlSpace.None);

            XmlReader xmlReader = XmlReader.Create(sr, new XmlReaderSettings(), parserContext);

            XslCompiledTransform transform = new XslCompiledTransform(true);

            using (Stream xsltStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("Tridion.ContentManager.Templating.Expression.NetbiscuitsFunctions.XhtmlToBBCode.xslt"))
            {
                using (XmlReader xsltReader = XmlReader.Create(xsltStream))
                {
                    transform.Load(xsltReader);
                }
            }

            StringWriter resultWriter = new StringWriter();
            XsltArgumentList argumentList = new XsltArgumentList();
            argumentList.AddParam("IncludeImages", String.Empty, outputImages);

            transform.Transform(xmlReader, argumentList, resultWriter);

            return resultWriter.ToString();   
        }
开发者ID:SGAnonymous,项目名称:sdl-tridion-world,代码行数:31,代码来源:NetbiscuitsFunctions.cs

示例2: 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

示例3: openFileButton_Click

        static int cellSize = 10;//网格大小 10m
        /// <summary>
        /// 打开并加载参数xml文档
        /// 将参数值存储到参数list中
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void openFileButton_Click(object sender, EventArgs e)
        {
            try
            {
                XmlDocument paraxml = new XmlDocument();
                OpenFileDialog fd = new OpenFileDialog();
                fd.Filter = "(*.xml;)|*.xml";
                fd.InitialDirectory = Application.StartupPath + @"";
                fd.ShowReadOnly = true;
                DialogResult result = fd.ShowDialog();
                if (result == DialogResult.OK)
                {
                    paraxml.Load(fd.FileName);
                }
                openFileButton.Enabled = false;

                NameTable xmt = new NameTable();
                XmlNamespaceManager xnm = new XmlNamespaceManager(xmt);
                xnm.AddNamespace(string.Empty, "");
                XmlNodeList xnlist = paraxml.SelectNodes("/ParameterML/ParameterList/Parameter/value");
                foreach (XmlNode xn in xnlist)
                {
                    paraList.Add(Convert.ToDouble(xn.InnerText));
                }
                calculateButton.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
开发者ID:wangfeilong321,项目名称:SmartCityModeling,代码行数:38,代码来源:Form1.cs

示例4: WDDeleteHiddenText

        public static void WDDeleteHiddenText(string docName)
        {
            // Given a document name, delete all the hidden text.
            const string wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

            using (WordprocessingDocument wdDoc = WordprocessingDocument.Open(docName, true))
            {
                // Manage namespaces to perform XPath queries.
                NameTable nt = new NameTable();
                XmlNamespaceManager nsManager = new XmlNamespaceManager(nt);
                nsManager.AddNamespace("w", wordmlNamespace);

                // Get the document part from the package.
                // Load the XML in the document part into an XmlDocument instance.
                XmlDocument xdoc = new XmlDocument(nt);
                xdoc.Load(wdDoc.MainDocumentPart.GetStream());
                XmlNodeList hiddenNodes = xdoc.SelectNodes("//w:vanish", nsManager);
                foreach (System.Xml.XmlNode hiddenNode in hiddenNodes)
                {
                    XmlNode topNode = hiddenNode.ParentNode.ParentNode;
                    XmlNode topParentNode = topNode.ParentNode;
                    topParentNode.RemoveChild(topNode);
                    if (!(topParentNode.HasChildNodes))
                    {
                        topParentNode.ParentNode.RemoveChild(topParentNode);
                    }
                }

                // Save the document XML back to its document part.
                xdoc.Save(wdDoc.MainDocumentPart.GetStream(FileMode.Create, FileAccess.Write));
            }
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:32,代码来源:Program.cs

示例5: 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

示例6: GetNamespaceManager

 private XmlNamespaceManager GetNamespaceManager()
 {
     NameTable nt = new NameTable();
     XmlNamespaceManager mgr = new XmlNamespaceManager(nt);
     mgr.AddNamespace("sn", "http://www.sensenet.com/2010");
     return mgr;
 }
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:7,代码来源:Xslt.cs

示例7: Execute

        public TestRunSummary Execute()
        {
            string vsFolder = Environment.Is64BitProcess ? @"%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE" : @"%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE";
            var nunitConsolePath = Path.Combine(AssemblyFolderHelper.GetTestAssemblyFolder(),
                Environment.ExpandEnvironmentVariables(vsFolder + @"\MsTest.exe"));

            string resultsFilePath = Path.Combine(inputProjectDriver.DeploymentFolder, "mstest-result.trx");

            var provessHelper = new ProcessHelper();
            provessHelper.RunProcess(nunitConsolePath, "\"/testcontainer:{0}\" \"/resultsfile:{1}\"", 
                inputProjectDriver.CompiledAssemblyPath, resultsFilePath);

            XDocument logFile = XDocument.Load(resultsFilePath);

            TestRunSummary summary = new TestRunSummary();

            XmlNameTable nameTable = new NameTable();
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(nameTable);
            namespaceManager.AddNamespace("mstest", "http://microsoft.com/schemas/VisualStudio/TeamTest/2010");

            var summaryElement = logFile.XPathSelectElement("//mstest:ResultSummary/mstest:Counters", namespaceManager);
            if (summaryElement != null)
            {
                summary.Total = int.Parse(summaryElement.Attribute("total").Value);
                summary.Succeeded = int.Parse(summaryElement.Attribute("passed").Value);
                summary.Failed = int.Parse(summaryElement.Attribute("failed").Value);
                summary.Pending = int.Parse(summaryElement.Attribute("inconclusive").Value);
                summary.Ignored = 0; // mstest does not support ignored in the report
            }

            testExecutionResult.LastExecutionSummary = summary;

            return summary;
        }
开发者ID:BEllis,项目名称:SpecFlow,代码行数:34,代码来源:MsTestTestExecutionDriver.cs

示例8: NuspecDocument

        static NuspecDocument()
        {
            var nameTable = new NameTable();

            _xmlNamespaceManager = new XmlNamespaceManager(nameTable);
            _xmlNamespaceManager.AddNamespace("nuspec", "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd");
        }
开发者ID:KevM,项目名称:ripple,代码行数:7,代码来源:NuspecDocument.cs

示例9: AddNameSpaceTable

 private XmlNamespaceManager AddNameSpaceTable(string parametersetname, XmlDocument xDoc, Hashtable namespacetable)
 {
     XmlNamespaceManager manager;
     if (parametersetname.Equals("Xml"))
     {
         XmlNameTable nameTable = new NameTable();
         manager = new XmlNamespaceManager(nameTable);
     }
     else
     {
         manager = new XmlNamespaceManager(xDoc.NameTable);
     }
     foreach (DictionaryEntry entry in namespacetable)
     {
         try
         {
             string prefix = entry.Key.ToString();
             manager.AddNamespace(prefix, entry.Value.ToString());
         }
         catch (NullReferenceException)
         {
             InvalidOperationException exception = new InvalidOperationException(StringUtil.Format(UtilityCommonStrings.SearchXMLPrefixNullError, new object[0]));
             ErrorRecord errorRecord = new ErrorRecord(exception, "PrefixError", ErrorCategory.InvalidOperation, namespacetable);
             base.WriteError(errorRecord);
         }
         catch (ArgumentNullException)
         {
             InvalidOperationException exception2 = new InvalidOperationException(StringUtil.Format(UtilityCommonStrings.SearchXMLPrefixNullError, new object[0]));
             ErrorRecord record2 = new ErrorRecord(exception2, "PrefixError", ErrorCategory.InvalidOperation, namespacetable);
             base.WriteError(record2);
         }
     }
     return manager;
 }
开发者ID:nickchal,项目名称:pash,代码行数:34,代码来源:SelectXmlCommand.cs

示例10: Validate

        /// <summary>
        /// Validates XML definition against given XSD schema.
        /// </summary>
        /// <param name="xmlFileName">Full path to the XML file on file system.</param>
        /// <param name="schemaContent">XSD schema.</param>
        /// <param name="schemaName">XSD schema name.</param>
        public void Validate(string xmlFileName, string schemaContent, string schemaName)
        {
            _xmlFileName = xmlFileName;

            var xmlDoc = GetUpdatedXml(xmlFileName, schemaName);
            var xmlSchemaSet = GetXmlSchema(schemaContent, schemaName);

            var nt = new NameTable();
            var nsmgr = new XmlNamespaceManager(nt);
            var context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);

            var settings = new XmlReaderSettings();
            settings.ValidationType = ValidationType.Schema;
            settings.Schemas.Add(xmlSchemaSet);
            settings.ValidationEventHandler += ValidationCallbackOne;

            using (var xmlr = new XmlTextReader(xmlDoc.OuterXml, XmlNodeType.Document, context))
            {
                using (var reader = XmlReader.Create(xmlr, settings))
                {
                    while (reader.Read())
                    {
                        var val = reader.Value;
                    }
                }
            }
        }
开发者ID:vegaitsourcing,项目名称:dbupgrade,代码行数:33,代码来源:XmlValidator.cs

示例11: 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

示例12: Initialize

		void Initialize ()
		{
			var nt = new NameTable ();
			initial_reader = new NonInteractiveStateXmlReader (String.Empty, nt, ReadState.Initial);
			eof_reader = new NonInteractiveStateXmlReader (String.Empty, nt, ReadState.EndOfFile);
			xml_reader = initial_reader;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:XmlMtomDictionaryReader.cs

示例13: ParseWordDoc

        private static string ParseWordDoc(Stream file)
        {
            const string wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";

            System.Text.StringBuilder textBuilder = new System.Text.StringBuilder();
            using (WordprocessingDocument wdDoc = WordprocessingDocument.Open(file, false))
            {

                NameTable nt = new NameTable();
                XmlNamespaceManager nsManager = new XmlNamespaceManager(nt);
                nsManager.AddNamespace("w", wordmlNamespace);
                XmlDocument xdoc = new XmlDocument(nt);
                xdoc.Load(wdDoc.MainDocumentPart.GetStream());

                XmlNodeList paragraphNodes = xdoc.SelectNodes("//w:p", nsManager);
                foreach (XmlNode paragraphNode in paragraphNodes)
                {
                    XmlNodeList textNodes = paragraphNode.SelectNodes(".//w:t", nsManager);
                    foreach (System.Xml.XmlNode textNode in textNodes)
                    {
                        textBuilder.Append(textNode.InnerText);
                    }
                    textBuilder.Append(Environment.NewLine);
                }

            }
            file.Close();
            return textBuilder.ToString();

        }
开发者ID:stephaneey,项目名称:Eyskens.AutoTaggerGit,代码行数:30,代码来源:FileHelper.cs

示例14: XmlEditorNavigator

		public XmlEditorNavigator(XmlEditorNavigator navigator ) 
		{
			//StreamUtil.WriteText("I:\\debug.txt","进到 构造函数XmlEditorNavigator(navigator)里\r\n");

            this.m_navigatorState = new NavigatorState(navigator.m_navigatorState);
            this.m_nametable = (NameTable)navigator.NameTable;
		}
开发者ID:renyh1013,项目名称:dp2,代码行数:7,代码来源:XmlEditorNavigator.cs

示例15: Patch

    /// <include file='doc\XmlPatch.uex' path='docs/doc[@for="XmlPatch.Patch3"]/*' />
    /// <summary>
    ///    Reads the XDL diffgram from the diffgramFileName and modifies the original XML document
    ///    sourceDoc according to the changes described in the diffgram. 
    /// </summary>
    /// <param name="sourceDoc">The original xml document</param>
    /// <param name="diffgramFileName">XmlReader for the XDL diffgram.</param>
	public void Patch( string sourceFile, Stream outputStream, XmlReader diffgram ) 
	{
        if ( sourceFile == null )
            throw new ArgumentNullException( "sourceFile" );
        if ( outputStream == null )
            throw new ArgumentNullException( "outputStream" );
        if ( diffgram == null ) 
            throw new ArgumentException( "diffgram" );

        XmlDocument diffDoc = new XmlDocument();
        diffDoc.Load( diffgram );

        // patch fragment
        if ( diffDoc.DocumentElement.GetAttribute( "fragments" ) == "yes" ) {
            NameTable nt = new NameTable();
            XmlTextReader tr = new XmlTextReader( new FileStream( sourceFile, FileMode.Open, FileAccess.Read ),
                                                  XmlNodeType.Element,
                                                  new XmlParserContext( nt, new XmlNamespaceManager( nt ),
                                                                        string.Empty, XmlSpace.Default ) );
            Patch( tr, outputStream, diffDoc ); 
        }
        // patch document
        else {
            Patch ( new XmlTextReader( sourceFile ), outputStream, diffDoc );
        }
	}
开发者ID:ViniciusConsultor,项目名称:sqlschematool,代码行数:33,代码来源:XmlPatch.cs


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