Click here to Skip to main content
15,899,124 members

Comments by g.bhangu (Top 7 by date)

g.bhangu 28-Jun-17 3:35am View    
Deleted
HI MACIEJ KINDLY DO THE REST FOR ME PLZ. MY SUBMISSION IS DUE, CNT TAKE CHANCE.
g.bhangu 28-Jun-17 2:10am View    
i have solved that problem thanks. another issue is :
https://www.codeproject.com/Questions/1193862/Compare-and-display-the-element-value-from-XML-fil

plz check.
g.bhangu 28-Jun-17 0:01am View    
this above file is resultant 33.xml file .
g.bhangu 27-Jun-17 23:54pm View    
Deleted
hi george, i am getting an xml comprises of two differnt xml, but it write the root element again, which is kinda break point.
kindly see my code:

using System.Xml.XPath;
namespace read_xml_elements
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();



//its saving well but motepacket is closed so confuse the reader

XElement xFileRoot = XElement.Load("11.xml");
XElement xFileChild = XElement.Load("55.xml");
xFileRoot.Add(xFileChild);
xFileRoot.Save("33.xml");


//reading the file well
XElement _x = XElement.Load(@"33.xml");
var lightElements = from page in _x.Elements("ParsedDataElement") where page.Element("Name").Value == "light" select page; foreach (var item in lightElements)
{
listBox1.Items.Add(item.Element("ConvertedValue").Value);
}
}
}
}

and the ans file is :
<?xml version="1.0" encoding="utf-8"?>
<motepacket>
<parseddataelement>
<name>amtype
<convertedvalue>11

<motepacket> //i dnt want this break
<parseddataelement>
<name>amtype
<convertedvalue>11



kindly see and suggest.
g.bhangu 27-Jun-17 23:29pm View    
hi this is giving an exception: Data at the root level is invalid. Line 1, position 1.plz help. i have the same issue,that i want to add the elements but root node should be same. no break in it.