public void persistdb <Key, Value, Data>(DBEngine <Key, Value> db) { XDocument xml = new XDocument(); xml.Declaration = new XDeclaration("1.0", "utf-8", "yes"); XComment comment = new XComment("NoSQL Database"); //title for XML xml.Add(comment); XElement NoSQLelem = new XElement("NoSQLDB_ELEMENTS"); XElement type = new XElement("numbers", typeof(Key)); XElement payload = new XElement("name", typeof(Data)); xml.Add(NoSQLelem); NoSQLelem.Add(type); NoSQLelem.Add(payload); foreach (Key k1 in db.Keys()) { XElement tags = new XElement("open_close"); XElement key = new XElement("new_Key", k1); //tag for new keys generated tags.Add(key); Value value1; db.getValue(k1, out value1); DBElement <Key, Data> element = value1 as DBElement <Key, Data>; WriteLine(element.showElement()); XElement dbelement = persistdbelement <Key, Data>(element); tags.Add(dbelement); NoSQLelem.Add(tags); xml.Save("XML_FILE.xml"); //XML file name } }
/// <summary> /// Tests the ElementsAfterSelf methods on Node. /// </summary> /// <param name="context"></param> /// <returns></returns> //[Variation(Desc = "NodeElementsAfterSelf")] public void NodeElementsAfterSelf() { XElement parent = new XElement("parent"); XElement child1a = new XElement("child1", new XElement("nested")); XElement child1b = new XElement("child1", new XElement("nested")); XElement child2a = new XElement("child2", new XElement("nested")); XElement child2b = new XElement("child2", new XElement("nested")); XComment comment = new XComment("this is a comment"); // If no parent, should not be any elements before it. Validate.Enumerator(comment.ElementsAfterSelf(), new XElement[0]); parent.Add(child1a); parent.Add(comment); parent.Add(child1b); parent.Add(child2a); parent.Add(child2b); Validate.Enumerator( comment.ElementsAfterSelf(), new XElement[] { child1b, child2a, child2b }); Validate.Enumerator( comment.ElementsAfterSelf("child1"), new XElement[] { child1b }); Validate.Enumerator( child1a.ElementsAfterSelf("child1"), new XElement[] { child1b }); Validate.Enumerator(child2b.ElementsAfterSelf(), new XElement[0]); }
/// <summary> /// Tests the ContentBeforeSelf method on Node. /// </summary> /// <param name="context"></param> /// <returns></returns> //[Variation(Desc = "NodeContentBeforeSelf")] public void NodeContentBeforeSelf() { XElement parent = new XElement("parent"); XComment child = new XComment("Self is a comment"); XComment comment1 = new XComment("Another comment"); XComment comment2 = new XComment("Yet another comment"); XElement element1 = new XElement("childelement", new XElement("nested"), new XAttribute("foo", "bar")); XElement element2 = new XElement("childelement2", new XElement("nested"), new XAttribute("foo", "bar")); XAttribute attribute = new XAttribute("attribute", "value"); // If no parent, should not be any content before it. Validate.Enumerator(child.NodesBeforeSelf(), new XNode[0]); // Add some content, including the child, and validate. parent.Add(attribute); parent.Add(comment1); parent.Add(element1); parent.Add(child); parent.Add(comment2); parent.Add(element2); Validate.Enumerator( child.NodesBeforeSelf(), new XNode[] { comment1, element1 }); }
/// <summary> /// Tests the AllContentAfterSelf method on Node. /// </summary> /// <param name="context"></param> /// <returns></returns> //[Variation(Desc = "NodeAllContentAfterSelf")] public void NodeAllContentAfterSelf() { XElement parent = new XElement("parent"); XComment child = new XComment("Self is a comment"); XComment comment1 = new XComment("Another comment"); XComment comment2 = new XComment("Yet another comment"); XElement element1 = new XElement("childelement", new XElement("nested"), new XAttribute("foo", "bar")); XElement element2 = new XElement("childelement2", new XElement("nested"), new XAttribute("foo", "bar")); XAttribute attribute = new XAttribute("attribute", "value"); // If no parent, should not be any content after it. Validate.Enumerator <XNode>(child.NodesAfterSelf(), new XNode[0]); // Add child to parent. Should still be no content after it. // Attributes are not content. parent.Add(child); parent.Add(attribute); Validate.Enumerator <XNode>(child.NodesAfterSelf(), new XNode[0]); // Add more children and validate. parent.AddFirst(comment1); parent.AddFirst(element1); Validate.Enumerator <XNode>(child.NodesAfterSelf(), new XNode[0]); parent.Add(element2); parent.Add(comment2); Validate.Enumerator <XNode>(child.NodesAfterSelf(), new XNode[] { element2, comment2 }); }
/// <summary> /// Process a comment that was in the document /// </summary> /// <param name="e">The comment element</param> /// <param name="node">The parent node</param> private void ProcessComment(XComment e, Node node) { string s = ""; s = Regex.Replace(e.Value, @"[^\w\.@-]", ""); node.Comments.Add(s); }
public void NodeContentAfterSelf() { XElement parent = new XElement("parent"); XComment child = new XComment("Self is a comment"); XComment comment1 = new XComment("Another comment"); XComment comment2 = new XComment("Yet another comment"); XElement element1 = new XElement("childelement", new XElement("nested"), new XAttribute("foo", "bar")); XElement element2 = new XElement("childelement2", new XElement("nested"), new XAttribute("foo", "bar")); XAttribute attribute = new XAttribute("attribute", "value"); // If no parent, should not be any content after it. Assert.Empty(child.NodesAfterSelf()); // Add some content, including the child, and validate. parent.Add(attribute); parent.Add(comment1); parent.Add(element1); parent.Add(child); parent.Add(comment2); parent.Add(element2); Assert.Equal(child.NodesAfterSelf(), new XNode[] { comment2, element2 }); }
private void XMLFileGeneration(List <String> selectedFiles) { XDocument XML = new XDocument(); if (selectedFiles.Count > 0) { XML.Declaration = new XDeclaration("1.0", "utf-8", "yes"); XComment comment = new XComment("CreatedBuild request from selected files"); XML.Add(comment); XElement testRequest = new XElement("testRequest"); XML.Add(testRequest); XElement child1 = new XElement("author", "Butchi Venkata Akhil Rao"); XElement child2 = new XElement("dateTime", DateTime.Now.ToString()); XElement child3 = new XElement("test"); XElement Subchild1 = new XElement("testDriver", selectedFiles[0]); child3.Add(Subchild1); for (int i = 1; i < selectedFiles.Count(); i++) { XElement SubChild2 = new XElement("tested", selectedFiles[i]); child3.Add(SubChild2); } testRequest.Add(child1); testRequest.Add(child2); testRequest.Add(child3); String path = @"../../../RepositoryStorage/" + "BuildRequest" + ".xml"; int count = 1; while (File.Exists(path)) { path = @"../../../RepositoryStorage/" + "BuildRequest" + count.ToString() + ".xml"; count++; } XML.Save(path); } }
public static XDocument AddProjectGuidToWebConfig(XDocument document, string projectGuid, bool ignoreProjectGuid) { try { if (document != null && !string.IsNullOrEmpty(projectGuid)) { IEnumerable <XComment> comments = document.DescendantNodes().OfType <XComment>(); projectGuid = projectGuid.Trim('{', '}', '(', ')').Trim(); string projectGuidValue = string.Format("ProjectGuid: {0}", projectGuid); XComment projectGuidComment = comments.FirstOrDefault(comment => string.Equals(comment.Value, projectGuidValue, StringComparison.OrdinalIgnoreCase)); if (projectGuidComment != null) { if (ignoreProjectGuid) { projectGuidComment.Remove(); } return(document); } if (!ignoreProjectGuid) { document.LastNode.AddAfterSelf(new XComment(projectGuidValue)); return(document); } } } catch { // This code path is only used for telemetry. } return(document); }
static IEnumerable <Entry> ReadCommentedKeyedValues(string path) { DirectoryInfo keyedDir = new DirectoryInfo(path); foreach (FileInfo file in keyedDir.EnumerateFiles("*.xml", SearchOption.TopDirectoryOnly)) { XDocument injectionsDoc; try { injectionsDoc = XDocument.Load(file.FullName); } catch (Exception ex) { Console.WriteLine(ex); Console.WriteLine("FIle {0} was impossible to read", file.FullName); continue; } XElement languageData = injectionsDoc.Root; languageData.Nodes().Where(node => node.NodeType == XmlNodeType.Comment); foreach (XElement keyedElement in languageData.Elements()) { XComment comment = keyedElement.PreviousNode as XComment; string etalon = comment == null ? string.Empty : _englishComment.Match(comment.Value).Groups[1].Value; yield return(new Entry(file.Name, keyedElement.Name.LocalName, etalon, keyedElement.Value)); } } }
public void UnCommentXElmenet_Test() { XComment commentedXElement = new XComment(TestConstants.TransactionXElem1); XElement xe = commentedXElement.UnCommentXElmenet(); Assert.IsTrue(TestConstants.TransactionXElem1.IgnoreWhiteSpaceEquals(xe.ToString())); }
/// <summary> /// Обработать комментарий. /// </summary> /// <param name="commentNode">Узел комментария.</param> /// <param name="setters">Набор "установщиков".</param> private void VisitComment(XComment commentNode, List <BaseSetter> setters) { var comment = commentNode.Value.Trim(); if (comment.Length > 2 && comment[0] == '{' && comment[comment.Length - 1] == '}') { comment = comment.Substring(1, comment.Length - 2); var setterExpressions = this.GetSetterExpressions(comment); foreach (var setterExpression in setterExpressions) { if (setterExpression[0] == '@') { if (setterExpression.Length > 1 && setterExpression[1] == '=') { setters.Add(new TextSetter(setterExpression.Substring(2))); } else { var equalsIndex = setterExpression.IndexOf('='); if (equalsIndex > 0) { var attributeName = setterExpression.Substring(1, equalsIndex - 1); var attributeExpression = setterExpression.Substring(equalsIndex + 1); setters.Add(new AttributeSetter(attributeName, attributeExpression)); } } } } } else { setters.Clear(); } }
/// <summary> /// Tests the WriteTo method on XComment. /// </summary> /// <param name="contextValue"></param> /// <returns></returns> //[Variation(Desc = "CommentWriteTo")] public void CommentWriteTo() { XComment c = new XComment("abcd "); // Null writer not allowed. try { c.WriteTo(null); Validate.ExpectedThrow(typeof(ArgumentNullException)); } catch (Exception ex) { Validate.Catch(ex, typeof(ArgumentNullException)); } // Test. StringBuilder stringBuilder = new StringBuilder(); XmlWriter xmlWriter = XmlWriter.Create(stringBuilder); xmlWriter.WriteStartElement("x"); c.WriteTo(xmlWriter); xmlWriter.WriteEndElement(); xmlWriter.Flush(); Validate.IsEqual( stringBuilder.ToString(), "<?xml version=\"1.0\" encoding=\"utf-16\"?><x><!--abcd --></x>"); }
/// <summary> /// Tests Remove on Node. /// </summary> /// <param name="context"></param> /// <returns></returns> //[Variation(Desc = "NodeRemove")] public void NodeRemove() { XElement parent = new XElement("parent"); XComment child1 = new XComment("child1"); XText child2 = new XText("child2"); XElement child3 = new XElement("child3"); parent.Add(child1, child2, child3); // Sanity check Validate.EnumeratorDeepEquals(parent.Nodes(), new XNode[] { child1, child2, child3 }); // Remove the text. child1.NextNode.Remove(); Validate.EnumeratorDeepEquals(parent.Nodes(), new XNode[] { child1, child3 }); // Remove the XComment. child1.Remove(); Validate.EnumeratorDeepEquals(parent.Nodes(), new XNode[] { child3 }); // Remove the XElement. child3.Remove(); Validate.EnumeratorDeepEquals(parent.Nodes(), new XNode[] { }); }
public void NodeRemove() { XElement parent = new XElement("parent"); XComment child1 = new XComment("child1"); XText child2 = new XText("child2"); XElement child3 = new XElement("child3"); parent.Add(child1, child2, child3); // Sanity check Assert.Equal(parent.Nodes(), new XNode[] { child1, child2, child3 }, XNode.EqualityComparer); // Remove the text. child1.NextNode.Remove(); Assert.Equal(new XNode[] { child1, child3 }, parent.Nodes(), XNode.EqualityComparer); // Remove the XComment. child1.Remove(); Assert.Equal(new XNode[] { child3 }, parent.Nodes(), XNode.EqualityComparer); // Remove the XElement. child3.Remove(); Assert.Empty(parent.Nodes()); }
public void Start() { XDocument xDocument = new XDocument(); XComment xComment = new XComment("Here is a comment."); xDocument.Add(xComment); XElement xElement = new XElement("Company", new XAttribute("MyAttribute", "MyAttributeValue"), new XElement("CompanyName", "AlbDarb"), new XElement("CompanyAddress", new XElement("Address", "123 Street"), new XElement("City", "Yerevan"), new XElement("State", "Arabkir"), new XElement("Country", "Armenia"))); xDocument.Add(xElement); //Console.WriteLine(xDocument.ToString()); xDocument.Save("sss.xml"); XDocument xDocument1 = XDocument.Load("sss.xml"); //Console.WriteLine(xDocument1); string jsonString = JsonConvert.SerializeXNode(xDocument1); Console.WriteLine(jsonString); xDocument1 = JsonConvert.DeserializeXNode(jsonString); //Console.WriteLine(xDocument1); }
internal static IXmlNode WrapNode(XObject node) { XDocument xDocument = node as XDocument; XDocument xDocument1 = xDocument; if (xDocument != null) { return(new XDocumentWrapper(xDocument1)); } XElement xElement = node as XElement; XElement xElement1 = xElement; if (xElement != null) { return(new XElementWrapper(xElement1)); } XContainer xContainer = node as XContainer; XContainer xContainer1 = xContainer; if (xContainer != null) { return(new XContainerWrapper(xContainer1)); } XProcessingInstruction xProcessingInstruction = node as XProcessingInstruction; XProcessingInstruction xProcessingInstruction1 = xProcessingInstruction; if (xProcessingInstruction != null) { return(new XProcessingInstructionWrapper(xProcessingInstruction1)); } XText xText = node as XText; XText xText1 = xText; if (xText != null) { return(new XTextWrapper(xText1)); } XComment xComment = node as XComment; XComment xComment1 = xComment; if (xComment != null) { return(new XCommentWrapper(xComment1)); } XAttribute xAttribute = node as XAttribute; XAttribute xAttribute1 = xAttribute; if (xAttribute != null) { return(new XAttributeWrapper(xAttribute1)); } XDocumentType xDocumentType = node as XDocumentType; XDocumentType xDocumentType1 = xDocumentType; if (xDocumentType != null) { return(new Class4(xDocumentType1)); } return(new XObjectWrapper(node)); }
public void XCommentChangeValue() { XComment toChange = new XComment("Original Value"); String newValue = "New Value"; XElement xElem = new XElement("root", toChange); XElement xElemOriginal = new XElement(xElem); using (UndoManager undo = new UndoManager(xElem)) { undo.Group(); using (EventsHelper eHelper = new EventsHelper(xElem)) { using (EventsHelper comHelper = new EventsHelper(toChange)) { toChange.Value = newValue; Assert.True(toChange.Value.Equals(newValue), "Value did not change"); xElem.Verify(); comHelper.Verify(XObjectChange.Value, toChange); } eHelper.Verify(XObjectChange.Value, toChange); } undo.Undo(); Assert.True(XNode.DeepEquals(xElem, xElemOriginal), "Undo did not work!"); } }
public void ContainerReplaceNodes() { XElement element = new XElement( "foo", new XAttribute("att", "bar"), "abc", new XElement("nested", new XText("abcd"))); // Replace with a node, attribute, string, some other value, and an IEnumerable. // ReplaceNodes does not remove attributes. XComment comment = new XComment("this is a comment"); XComment comment2 = new XComment("this is a comment 2"); XComment comment3 = new XComment("this is a comment 3"); XAttribute attribute = new XAttribute("att2", "att-value"); string str = "this is a string"; TimeSpan other1 = new TimeSpan(1, 2, 3); element.ReplaceNodes(comment, attribute, str, other1, new XComment[] { comment2, comment3 }); Assert.Equal( new XNode[] { comment, new XText(str + XmlConvert.ToString(other1)), comment2, comment3 }, element.Nodes(), XNode.EqualityComparer); Assert.Equal(2, element.Attributes().Count()); Assert.Equal("att", element.Attribute("att").Name); Assert.Equal("bar", element.Attribute("att").Value); Assert.Equal("att2", element.Attribute("att2").Name); Assert.Equal("att-value", element.Attribute("att2").Value); }
public static XDocument ConvertCsvToXML(List <Dictionary <string, string> > dataContents, string filename) { string dirName = new DirectoryInfo(filename).Name.Replace(".csv", ""); //Create the element var xsyntax = new XDocument(new XDeclaration("1.0", "UTF-8", "yes")); //<?xml version="1.0" encoding="utf-8" standalone="yes"?> XComment comm = new XComment("Exported from Orchard"); // Create the Comment ---> <!--Exported from Orchard--> var xHead = new XElement("Orchard"); // Create the head --> <Orchard> var xContentDe = new XElement("ContentDefinition"); //Create the ContentDefinition --> <ContentDefinition> var xContent = new XElement("Content"); //Create the Content --> <Content> // load previous data from database LoadFromDataBase(dirName); for (int i = 0; i < dataContents.Count; i++) { xContent.Add(Content(dataContents[i], dirName)); } xContentDe.Add(Type(dirName) /*, Part(rows[0], dirName)*/); xHead.Add(Reciperow(), xContentDe, xContent); // save import id and identity SaveToDataBase(xContent); // xsyntax.Add(comm, xHead); return(xsyntax); }
public void HtmlElement_Comment() { Browser b = new Browser(); b.SetContent(Helper.GetFromResources("SimpleBrowser.UnitTests.SampleDocs.CommentElements.htm")); b.Find("link1"); IEnumerable <XComment> comments = from node in b.XDocument.Elements().DescendantNodesAndSelf() where node.NodeType == XmlNodeType.Comment select node as XComment; XComment comment = comments.First(); Assert.That(comment.ToString(), Is.EqualTo("<!-- Valid comment -->")); comment = comments.Skip(1).First(); Assert.That(comment.ToString(), Is.EqualTo("<!-- Malformed comment -->")); // Nr 3 is a comment inside a script block comment = comments.Skip(3).First(); Assert.That(comment.ToString(), Is.EqualTo("<!--[if gt IE 9]-->")); comment = comments.Skip(4).First(); Assert.That(comment.ToString(), Is.EqualTo("<!--[endif]-->")); comment = comments.Skip(5).First(); Assert.That(comment.ToString(), Is.EqualTo("<!--[if gt IE 10]>\r\n<a id=\"link2\" href=\"http://www.microsoft.com\">Downlevel-hidden conditional comment test</a>\r\n<![endif]-->")); }
static IEnumerable <Entry> ReadCommentedInjections(string injectionsDirPath) { List <Entry> results = new List <Entry>(); DirectoryInfo injectionsDir = new DirectoryInfo(injectionsDirPath); foreach (DirectoryInfo injectionTypeDir in injectionsDir.EnumerateDirectories()) { string defType = injectionTypeDir.Name.Replace("Defs", "Def"); foreach (FileInfo file in injectionTypeDir.EnumerateFiles("*.xml", SearchOption.TopDirectoryOnly)) { try { XDocument injectionsDoc = XDocument.Load(file.FullName); XElement languageData = injectionsDoc.Root; foreach (XElement injection in languageData.Elements()) { XComment comment = injection.PreviousNode as XComment; string etalon = comment == null ? string.Empty : _englishComment.Match(comment.Value).Groups[1].Value; results.Add(new Entry(defType, injection.Name.LocalName, etalon, injection.Value)); } } catch (Exception ex) { Console.WriteLine(ex); Console.WriteLine("FIle {0} was impossible to read", file.FullName); continue; } } } return(results); }
static void MergeToMaster(XDocument MasterCcd, List <XElement> elements, string code) { XComment MergeMessage = new XComment("Merged Information By Randomization Engine"); //removes elements from the section MasterCcd.Descendants().Elements().Last(x => x.Name.LocalName == "section" && x.Elements().Count(y => { var yAttribute = y.Attribute("code"); return(yAttribute != null && (y.Name.LocalName == "code" && yAttribute.Value == code)); }) > 0).Elements().Where(x => x.Name.LocalName == "entry").Remove(); //Adds each element in the list to the master ccd foreach (var i in elements) { i.AddFirst(MergeMessage); MasterCcd.Descendants().Last(x => x.Name.LocalName == "section" && x.Elements().Count(y => { var yAttribute = y.Attribute("code"); return(yAttribute != null && (y.Name.LocalName == "code" && yAttribute.Value == code)); }) > 0).Add(i); } }
public void NodeElementsAfterSelf() { XElement parent = new XElement("parent"); XElement child1a = new XElement("child1", new XElement("nested")); XElement child1b = new XElement("child1", new XElement("nested")); XElement child2a = new XElement("child2", new XElement("nested")); XElement child2b = new XElement("child2", new XElement("nested")); XComment comment = new XComment("this is a comment"); // If no parent, should not be any elements before it. Assert.Empty(comment.ElementsAfterSelf()); parent.Add(child1a); parent.Add(comment); parent.Add(child1b); parent.Add(child2a); parent.Add(child2b); Assert.Equal(new XElement[] { child1b, child2a, child2b }, comment.ElementsAfterSelf()); Assert.Equal(new XElement[] { child1b }, comment.ElementsAfterSelf("child1")); Assert.Equal(new XElement[] { child1b }, child1a.ElementsAfterSelf("child1")); Assert.Empty(child2b.ElementsAfterSelf()); }
public void NodeAllContentBeforeSelf() { XElement parent = new XElement("parent"); XComment child = new XComment("Self is a comment"); XComment comment1 = new XComment("Another comment"); XComment comment2 = new XComment("Yet another comment"); XElement element1 = new XElement("childelement", new XElement("nested"), new XAttribute("foo", "bar")); XElement element2 = new XElement("childelement2", new XElement("nested"), new XAttribute("foo", "bar")); XAttribute attribute = new XAttribute("attribute", "value"); // If no parent, should not be any content before it. Assert.Empty(child.NodesBeforeSelf()); // Add child to parent. Should still be no content before it. // Attributes are not content. parent.Add(attribute); parent.Add(child); Assert.Empty(child.NodesBeforeSelf()); // Add more children and validate. parent.Add(comment1); parent.Add(element1); Assert.Empty(child.NodesBeforeSelf()); parent.AddFirst(element2); parent.AddFirst(comment2); Assert.Equal(new XNode[] { comment2, element2 }, child.NodesBeforeSelf()); }
static void MergeComment(XComment dst, XComment src) { if (dst.Value != src.Value) { dst.Value = src.Value; } }
/*----------------------------------------------------<this is to send xml files to build>--------------------------------------------*/ private string generateXmlFile(List <String> selectedFiles) { XDocument xml = new XDocument(); String path = @"../../../RepositoryStorage/" + "BuildRequest" + ".xml"; if (selectedFiles.Count > 0) { xml.Declaration = new XDeclaration("1.0", "utf-8", "yes"); XComment comment = new XComment("CreatedBuild request from selected files"); xml.Add(comment); XElement testRequest = new XElement("testRequest"); xml.Add(testRequest); XElement child1 = new XElement("author", "Rishit Reddy"); XElement child2 = new XElement("dateTime", DateTime.Now.ToString()); XElement child3 = new XElement("test"); XElement grandchild1 = new XElement("testDriver", selectedFiles[0]); child3.Add(grandchild1); for (int i = 1; i < selectedFiles.Count(); i++) { XElement grandchild2 = new XElement("tested", selectedFiles[i]); child3.Add(grandchild2); } testRequest.Add(child1); testRequest.Add(child2); testRequest.Add(child3); int count = 1; while (File.Exists(path)) { path = @"../../../RepositoryStorage/" + "BuildRequest" + count.ToString() + ".xml"; count++; } xml.Save(path); } return(path); }
/// <summary> /// Initializes a new comment node from an existing comment node. /// </summary> /// <param name="other">Comment node to copy from.</param> public XComment(XComment other) { if (other == null) { throw new ArgumentNullException("other"); } this.value = other.value; }
public void ToXComment_Test(HtmlComment comment, XComment expected) { // Act var actual = comment.ToXComment(); // Assert Assert.That(actual, Is.EqualTo(expected).Using <XNode>(XNode.EqualityComparer)); }
private IEnumerable <Inline> RenderComment(XComment comment) { yield return(Comment("<!--")); yield return(Comment(comment.Value)); yield return(Comment("-->")); }
public static XComment WriteComment(this XElement elem, string data) { XComment c = new XComment(data); elem.Add(c); return(c); }
public void Comment(string value1, string value2, bool checkHashCode) { XComment c1 = new XComment(value1); XComment c2 = new XComment(value2); VerifyComparison(checkHashCode, c1, c2); XDocument doc = new XDocument(c1); XElement e2 = new XElement("p2p", c2); VerifyComparison(checkHashCode, c1, c2); }
/// <summary> /// Initializes a new comment node from an existing comment node. /// </summary> /// <param name="other">Comment node to copy from.</param> public XComment(XComment other) { if (other == null) throw new ArgumentNullException("other"); this.value = other.value; }
public void Element6(int param) { XElement e1 = new XElement("A", "datata"); XElement e2 = new XElement("A", "datata"); switch (param) { case 1: XComment c = new XComment("hele"); e2.Add(c); c.Remove(); break; case 2: break; } VerifyComparison(true, e1, e2); }