linq-to-xml Questions
3
Solved
XDocument.Load throws an exception when using an XML file with version 1.1 instead of 1.0:
Unhandled Exception: System.Xml.XmlException: Version number '1.1' is invalid. Line 1, position 16.
An...
Accountancy asked 26/5, 2009 at 20:6
2
Solved
Using XNode.DeepEquals() to compare xml elements, it unexpectedly returns false on two xml documents that I think should be equivalent.
Example
var xmlFromString = XDocument.Parse("<someXml xm...
Dolor asked 11/6, 2014 at 7:7
3
Solved
I want to load large XML documents into XDocument objects.
The simple synchronous approach using XDocument.Load(path, loadOptions) works great, but blocks for an uncomfortably long time in a GUI co...
Destefano asked 24/4, 2017 at 14:8
3
I have read a comparison between the two here. This is primarily a question of performance, relating to both memory and speed.
I've got several XML documents that are upwards of 100 - 300 K in siz...
Karmakarmadharaya asked 8/12, 2010 at 3:33
4
Solved
I'm generating an utf-8 XML file using XDocument.
XDocument xml_document = new XDocument(
new XDeclaration("1.0", "utf-8", null),
new XElement(ROOT_NAME,
new XAttribute("note", note)
)
);
.....
Cubitiere asked 9/2, 2011 at 8:46
7
Solved
I'm loading an XML document in my C# application with the following:
XDocument xd1 = new XDocument();
xd1 = XDocument.Load(myfile);
but before that, I do test to make sure the file exists with:
...
Tagmeme asked 17/12, 2008 at 18:44
3
Solved
I've an XML file like below:
<Employees>
<Employee Id="ABC001">
<Name>Prasad 1</Name>
<Mobile>9986730630</Mobile>
<Address Type="Perminant">
<City...
Knowlton asked 7/9, 2016 at 2:30
6
Solved
My current project (C# 3.5) has a lot of code like this (elem is an instance of XElement):
textbox1.Text = elem.Element("TagName") == null ? "" : elem.Element("TagName").Value;
Is there any way ...
Dorwin asked 23/5, 2011 at 10:51
3
Solved
I've made a method which checks if an attribute exist in a XML-file. If it does not exist it returns "False". It works but it takes a very long time to parse the file. It seems it reads the whole f...
Relapse asked 12/11, 2012 at 10:34
6
Solved
Is there any way to have an XDocument print the xml version when using the ToString method? Have it output something like this:
<?xml version="1.0"?>
<!DOCTYPE ELMResponse [
]>
<Res...
Massey asked 5/6, 2009 at 17:32
3
Solved
When i use the results of a linq-to-xml query to populate a datagridview, i cannot edit the datagridview. i've tried setting the datagridview's readonly property to false and that doesn't help. I a...
Integrand asked 22/2, 2010 at 15:0
2
Solved
I have a XDocument that looks like this:
XDocument outputDocument = new XDocument(
new XElement("Document",
new XElement("Stuff")
)
);
That when I call
outputDocument.ToString()
Outputs ...
Fabiolafabiolas asked 17/3, 2010 at 0:21
4
Solved
Before posting this question I have tried all other solution on stack, but with no success.
I am unable to remove empty xmlns attribute from XElement using C#, I have tried the following Codes.
X...
Sandglass asked 1/5, 2015 at 4:47
3
The following code produces this output:
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<customers>
<customer>
<firstName>Jim</firstName>
<lastName>...
Pled asked 20/7, 2010 at 8:44
3
Solved
I have an XDocument that I create from a byte array (received over tcp/ip).
I then search for specific xml nodes (XElements) and after retrieving the value 'pop' it off of the Xdocument by calling...
Silvey asked 27/7, 2011 at 21:5
10
Solved
I have an XDocument object. I want to query for elements with a particular name at any depth using LINQ.
When I use Descendants("element_name"), I only get elements that are direct childr...
Polivy asked 19/2, 2009 at 16:46
6
Solved
I am using XDocument.Validate (it seems to function the same as XmlDocument.Validate) to validate an XML document against an XSD - this works well and I am informed of validation errors.
However, ...
Caustic asked 3/2, 2013 at 21:42
2
I am working with C# (ASP.Net, MVC) and Newtonsoft for JSON serialization. I get an XDocument like the one below which I would like to have in JSON format, for the view.
<group>
<name>...
Proline asked 7/8, 2012 at 10:6
3
Solved
I have an XElement which has content like this.
<Response xmlns="someurl" xmlnsLi="thew3url">
<ErrorCode></ErrorCode>
<Status>Success</Status>
<Result>
<...
Starch asked 1/6, 2012 at 4:23
2
Solved
I have a List<string> "sampleList" which contains
Data1
Data2
Data3...
The file structure is like
<file>
<name filename="sample"/>
<date modified =" "/>
<info>
...
Decimeter asked 1/6, 2010 at 8:31
2
Does anyone have a neat way of finding or creating an XObject using an xpath expression.
The problem I am having is that I need to set a value on an element (which I have the xpath for), which ma...
Chacon asked 4/1, 2011 at 14:4
3
Solved
I have a case where I would like to generate xml prior to posting it to an API, containing line breaks (\n) but not carriage returns (no \r).
In C# though, it seems that XDocument automatically ad...
Mandate asked 29/9, 2016 at 15:25
4
Solved
I have an xml file from which I am extracting html using LINQ to XML. This is a sample of the file:
<?xml version="1.0" encoding="utf-8" ?>
<tips>
<tip id="0">
This is the firs...
Casemate asked 19/1, 2009 at 15:27
6
Solved
I have created a XElement with node which has XML as below.
I want to remove all the "Rule" nodes if they contain "conditions" node.
I create a for loop as below, but it does no...
Flews asked 27/1, 2015 at 11:10
7
Solved
I have a simple XML
<AllBands>
<Band>
<Beatles ID="1234" started="1962">greatest Band<![CDATA[lalala]]></Beatles>
<Last>1</Last>
<Salary>2</S...
Pulsar asked 10/12, 2011 at 22:34
© 2022 - 2024 — McMap. All rights reserved.