Answer the question
In order to leave comments, you need to log in
How to edit XML file with namespace prefixes via Linq to XML?
Please, prompt: It is
necessary to create an XML file with tags of this kind. <mecp:RoomCount part="15.2.6">3</mecp:RoomCount>
When I create a file from scratch, there are no problems.
Adding a namespace to the root element
foreach (KeyValuePair<string, XNamespace> item in dctNameSpace)
{
_xNode.Add(new XAttribute(XNamespace.Xmlns + item.Key, item.Value.NamespaceName));
}
xWorkDay.Add(new XElement(mecdv + "DayOfWeek", new XAttribute("part", "1.3.1"), item.WeekDay));
<mecp:RoomCount>3</mecp:RoomCount>
<RoomCount xmlns="fdsfsfdfgvdfg">3</RoomCount>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question