I am following a tutorial and it works fine when i load a basic xml file.
xml
<?xml version="1.0" encoding="utf-8" ?>
<Students>
<Student ID="1">
<Name>Test1</Name>
</Student>
<Student ID="2">
<Name>Test2</Name>
</Student>
<Student ID="3">
<Name>Test3 </Name>
</Student>
</Students>
C#
XDocument testXML = XDocument.Load(@"C:\Users\b\Desktop\SITE\xml.xml");
var students = from student in testXML.Descendants("Student")
select new
{
ID = student.Attribute("ID").Value
};
foreach (var student in students)
{
xmlTitle.Text += "</br>" + student.ID + " </br>";
}
output:
Now, I want to add this tag before the
<Students>
<outputTree xmlns="http://ift.tt/1sL7eZL" xmlns:xsi="http://ift.tt/ra1lAU" xsi:schemaLocation="http://ift.tt/1sL7eZL http://ift.tt/1sL7eZN">
I tried for ages but i cant get it working. when i add
XNamespace ns = "http://ift.tt/1sL7eZL";
No comments:
Post a Comment