當前位置: 首頁>>代碼示例>>C#>>正文


C# Linq.XText類代碼示例

本文整理匯總了C#中System.Xml.Linq.XText的典型用法代碼示例。如果您正苦於以下問題:C# XText類的具體用法?C# XText怎麽用?C# XText使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XText類屬於System.Xml.Linq命名空間,在下文中一共展示了XText類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MakeWrapper

 public static XObjectWrapper MakeWrapper(XText obj)
 {
     if (obj is XCData)
         return MakeWrapper((XCData)obj);
     else
         return new XTextWrapper(obj);
 }
開發者ID:zanyants,項目名稱:saxon-xdoc,代碼行數:7,代碼來源:XObjectWrapper.cs

示例2: CalibrateText

 private static XText CalibrateText(XText n)
 {
     if (n.parent == null)
     {
         return n;
     }
     XNode content = (XNode) n.parent.content;
     while (true)
     {
         content = content.next;
         XText text = content as XText;
         if (text != null)
         {
             do
             {
                 if (content == n)
                 {
                     return text;
                 }
                 content = content.next;
             }
             while (content is XText);
         }
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:25,代碼來源:Extensions.cs

示例3: ProcessXText

 private void ProcessXText(XText xtext, StringBuilder sb, bool performReplacements)
 {
     //.NET likes to just drop out some of the formatting, specially the " which becomes normal old double quotes.
     var correctedText = XmlTextEncoder.Encode(xtext.Value);
     var newvalue = performReplacements ? Replace(correctedText) : correctedText;
     sb.Append(newvalue);
 }
開發者ID:gamako,項目名稱:IntroToRx,代碼行數:7,代碼來源:WordWrapParserBase.cs

示例4: Service

 public Service(XElement baseElement, Product parent)
 {
     _nameAndRev = baseElement.Elements(_ns + "span").Nodes().OfType<XText>().FirstOrDefault();
       _amountSpan = baseElement.Elements(_ns + "span").Elements(_ns + "span").Nodes().OfType<XText>().ToList();
       _options = new List<Option>();
       Product = parent;
 }
開發者ID:garmstrong11,項目名稱:RFQBuddy,代碼行數:7,代碼來源:Service.cs

示例5: AdjacentTextNodes2

                //[Variation(Priority = 3, Desc = "Adjacent text nodes II. (sanity)")]
                public void AdjacentTextNodes2()
                {
                    XText t1 = new XText("a");
                    XElement e = new XElement("root", "hello");
                    e.Add(t1);

                    VerifyOrder(e.FirstNode, t1, -1);
                }
開發者ID:johnhhm,項目名稱:corefx,代碼行數:9,代碼來源:DocOrderComparer.cs

示例6: AdjacentTextNodes1

                //[Variation(Priority = 3, Desc = "Adjacent text nodes I. (sanity)")]
                public void AdjacentTextNodes1()
                {
                    XText t1 = new XText("a");
                    XText t2 = new XText("");
                    XElement e = new XElement("root", t1, t2);

                    VerifyOrder(t1, t2, -1);
                }
開發者ID:johnhhm,項目名稱:corefx,代碼行數:9,代碼來源:DocOrderComparer.cs

示例7: XText

 public XText(XText other)
 {
     if (other == null)
     {
         throw new ArgumentNullException("other");
     }
     this.text = other.text;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:8,代碼來源:XText.cs

示例8: Test_text_node

 public void Test_text_node()
 {
     var tx = new XText("This is some text");
     var e1 = new XElement("Root", tx);
     var d1 = new XDocument(e1);
     var di = d1.GetObjectId();
     var id = e1.GetObjectId();
     var ti = tx.GetObjectId();
     var d2 = XNodeAnnotationSerializer.Serialize(d1);
     var d3 = XNodeAnnotationSerializer.Deserialize(d2);
     Assert.IsTrue(d3.Root.FirstNode.GetObjectId() == ti);
 }
開發者ID:nxkit,項目名稱:nxkit,代碼行數:12,代碼來源:AnnotationSerializationTests.cs

示例9: ReplaceFields

 private void ReplaceFields()
 {
     var elements = DocumentContent.XPathSelectElements( @"//text:text-input[ @text:description = 'Template']",
                                                         Manager );
     var nodes = elements.ToList();
     foreach( var element in nodes )
     {
         var attribute = element.Value;
         var preparedAttribute = attribute.Replace( "U+10FFFD", "@" );
         var text = new XText( preparedAttribute );
         element.ReplaceWith( text );
     }
 }
開發者ID:EventBooking,項目名稱:AntiShaun,代碼行數:13,代碼來源:OdtTemplate.cs

示例10: CreateControlFlowFromComment

        private void CreateControlFlowFromComment( XElement comment )
        {
            var row = comment.XPathSelectElement( "./ancestor::table:table-row", Manager );
            var commentValue = comment.Value.Replace( "U+10FFFD", "@" );

            var beforeNode = new XText( commentValue + "{" );

            var afterNode = new XText( "}" );

            row.AddBeforeSelf( beforeNode );
            row.AddAfterSelf( afterNode );
            comment.Remove();
        }
開發者ID:EventBooking,項目名稱:AntiShaun,代碼行數:13,代碼來源:OdsTemplate.cs

示例11: XmlEncode

	/// <summary>
	/// Encodes a string for use in an XML element or attribute.
	/// </summary>
	/// <param name="value" this="true">The value to encode in XML compatible way.</param>
	/// <returns>The XML encoded string.</returns>
	public static string XmlEncode(this string value)
	{
		Guard.NotNull(() => value, value);

		var output = new StringBuilder();
		var text = new XText(value);

		using (var writer = XmlWriter.Create(output, new XmlWriterSettings { ConformanceLevel = ConformanceLevel.Fragment }))
		{
			text.WriteTo(writer);
			writer.Flush();
			return output.ToString();
		}
	}
開發者ID:netfx,項目名稱:extensions,代碼行數:19,代碼來源:XmlEncode.cs

示例12: NodeTypes

                //[Variation(Desc = "NodeTypes")]
                public void NodeTypes()
                {
                    XDocument document = new XDocument();
                    XElement element = new XElement("x");
                    XText text = new XText("text-value");
                    XComment comment = new XComment("comment");
                    XProcessingInstruction processingInstruction = new XProcessingInstruction("target", "data");

                    Validate.IsEqual(document.NodeType, XmlNodeType.Document);
                    Validate.IsEqual(element.NodeType, XmlNodeType.Element);
                    Validate.IsEqual(text.NodeType, XmlNodeType.Text);
                    Validate.IsEqual(comment.NodeType, XmlNodeType.Comment);
                    Validate.IsEqual(processingInstruction.NodeType, XmlNodeType.ProcessingInstruction);
                }
開發者ID:johnhhm,項目名稱:corefx,代碼行數:15,代碼來源:SDMMisc.cs

示例13: WriteAsCode

 /// <summary>
 /// Write as C# code.
 /// </summary>
 private static void WriteAsCode(XText text, CommentSection section, bool inCode)
 {
     var lineNo = 0;
     var content = text.Value;
     if (string.IsNullOrEmpty(content))
         return;
     foreach (var part in content.Split('\n'))
     {
         if ((lineNo > 0) && inCode)
             section.WriteLine();
         section.Write(part.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;"));
         lineNo++;
     }
 }
開發者ID:rfcclub,項目名稱:dot42,代碼行數:17,代碼來源:DocDescription.cs

示例14: NodeTypes

        public void NodeTypes()
        {
            XDocument document = new XDocument();
            XElement element = new XElement("x");
            XText text = new XText("text-value");
            XComment comment = new XComment("comment");
            XProcessingInstruction processingInstruction = new XProcessingInstruction("target", "data");

            Assert.Equal(XmlNodeType.Document, document.NodeType);
            Assert.Equal(XmlNodeType.Element, element.NodeType);
            Assert.Equal(XmlNodeType.Text, text.NodeType);
            Assert.Equal(XmlNodeType.Comment, comment.NodeType);
            Assert.Equal(XmlNodeType.ProcessingInstruction, processingInstruction.NodeType);
        }
開發者ID:Rayislandstyle,項目名稱:corefx,代碼行數:14,代碼來源:SDMMisc.cs

示例15: CollectText

 private static string CollectText(XText n)
 {
     string str = n.Value;
     if (n.parent != null)
     {
         while (n != n.parent.content)
         {
             n = n.next as XText;
             if (n == null)
             {
                 return str;
             }
             str = str + n.Value;
         }
     }
     return str;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:17,代碼來源:XNodeNavigator.cs


注:本文中的System.Xml.Linq.XText類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。