本文整理汇总了C#中System.Xml.Linq.XText类的典型用法代码示例。如果您正苦于以下问题:C# XText类的具体用法?C# XText怎么用?C# XText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XText类属于System.Xml.Linq命名空间,在下文中一共展示了XText类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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("&", "&").Replace("<", "<").Replace(">", ">"));
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
示例16: CreateControlFlowSection
private void CreateControlFlowSection( XElement script )
{
//TODO: Test this method
var parentSection = script.XPathSelectElement( "./ancestor::text:section", Manager );
// TODO: If ParentSection is null, throw specific exception
var scriptValue = script.Value.Replace( "U+10FFFD", "@" );
var beforeNode = new XText( scriptValue + "{" );
var afterNode = new XText( "}" );
parentSection.AddBeforeSelf( beforeNode );
parentSection.AddAfterSelf( afterNode );
script.Remove();
}
开发者ID:EventBooking,项目名称:AntiShaun,代码行数:19,代码来源:OdtTemplate.cs
示例17: Parent
public void Parent()
{
JArray v = new JArray(new JConstructor("TestConstructor"), new JValue(new DateTime(2000, 12, 20)));
Assert.AreEqual(null, v.Parent);
JObject o =
new JObject(
new JProperty("Test1", v),
new JProperty("Test2", "Test2Value"),
new JProperty("Test3", "Test3Value"),
new JProperty("Test4", null)
);
Assert.AreEqual(o.Property("Test1"), v.Parent);
JProperty p = new JProperty("NewProperty", v);
// existing value should still have same parent
Assert.AreEqual(o.Property("Test1"), v.Parent);
// new value should be cloned
Assert.AreNotEqual(p.Value, v);
Assert.AreEqual((DateTime)((JValue)p.Value[1]).Value, (DateTime)((JValue)v[1]).Value);
Assert.AreEqual(v, o["Test1"]);
XText t = new XText("XText");
Assert.AreEqual(null, t.Parent);
Assert.AreEqual(null, o.Parent);
JProperty o1 = new JProperty("O1", o);
Assert.AreEqual(o, o1.Value);
Assert.AreNotEqual(null, o.Parent);
JProperty o2 = new JProperty("O2", o);
Assert.AreNotEqual(o1.Value, o2.Value);
Assert.AreEqual(o1.Value.Children().Count(), o2.Value.Children().Count());
Assert.AreEqual(false, JToken.DeepEquals(o1, o2));
Assert.AreEqual(true, JToken.DeepEquals(o1.Value, o2.Value));
}
开发者ID:xxjeng,项目名称:nuxleus,代码行数:43,代码来源:JTokenTests.cs
示例18: ExecuteXDocumentVariation
public void ExecuteXDocumentVariation(XNode toReplace)
{
XNode newValue = new XText(" ");
XDocument xDoc = new XDocument(toReplace);
XDocument xDocOriginal = new XDocument(xDoc);
using (UndoManager undo = new UndoManager(xDoc))
{
undo.Group();
using (EventsHelper docHelper = new EventsHelper(xDoc))
{
xDoc.ReplaceNodes(newValue);
Assert.True(xDoc.Nodes().Count() == 1, "Not all content were removed");
Assert.True(Object.ReferenceEquals(xDoc.FirstNode, newValue), "Did not replace correctly");
docHelper.Verify(new XObjectChange[] { XObjectChange.Remove, XObjectChange.Add }, new XObject[] { toReplace, newValue });
}
undo.Undo();
Assert.True(XNode.DeepEquals(xDoc, xDocOriginal), "Undo did not work!");
}
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:19,代码来源:EventsReplace.cs
示例19: CreateRuns
IEnumerable<XElement> CreateRuns(XText node,bool preservespace)
{
var rtn = new List<XElement>();
if(!preservespace)
{
var run = CreateRun(GetInnerText(node.Value, false));
rtn.Add(run);
return rtn;
}
var lines = node.Value.Split(new char[] {'\r', '\n'}, StringSplitOptions.RemoveEmptyEntries);
foreach(var line in lines)
{
var run = CreateRun(line);
rtn.Add(run);
rtn.Add(CreateLineBreak());
}
if (rtn.Count > 0)
rtn.Remove(rtn.Last());
return rtn;
}
开发者ID:heartszhang,项目名称:WeiZhi3,代码行数:20,代码来源:FlowDocumentTranscoder.cs
示例20: handle_blog_archive_page
private void handle_blog_archive_page(System.Net.HttpListenerContext context)
{
this.WriteLogMethodName();
var xdoc = CreateHtmlDom();
var el_body = xdoc.Element("html").Element("body");
el_body.AddH1Element(this.BlogTitle);
el_body.AddAnchorElement("/", "Home");
foreach (var post in this.PostList)
{
var el_para = el_body.AddParagraphElement();
var el_text =
new System.Xml.Linq.XText(post.DateCreated == null
? "No Publish Date"
: post.DateCreated.Value.ToShortDateString());
el_para.Add(el_text);
el_para.AddAnchorElement(post.Link, post.Title);
}
WriteResponseString(context, xdoc.ToString(), 200, ContentType_TextHtml);
}
开发者ID:csantero,项目名称:MetaWeblogPortable,代码行数:22,代码来源:BlogServer_Rendering.cs
注:本文中的System.Xml.Linq.XText类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论