linq-to-xml Questions

5

Solved

I have an XElement that looks like this: <User ID="11" Name="Juan Diaz" LoginName="DN1\jdiaz" xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/" /> How can I use XML to extrac...
Myeloid asked 22/7, 2013 at 13:48

3

Solved

I have this xml <config> <audio first="true" second="false" third="true" /> </config> I want my code to able to do something like this if (xdoc.getAttr("first")=="true") Con...
Thorrlow asked 13/12, 2010 at 14:39

2

I have a partial XML string without a root element. E.g.: <Item Id="1">some text</Item> <Item Id="2">some other text</Item> I need to convert this strin...
Wouldst asked 22/7, 2021 at 9:45

4

Solved

I have a 150 MB XML file which is used as DB in my project. Currently I'm using XmlReader to read content from it. I want to know if it is better to use XmlReader or LINQ to XML for this scenario. ...
Phthalocyanine asked 29/4, 2010 at 7:20

7

Solved

I have an old XmlNode-based code. but the simplest way to solve my current task is to use XElement and LINQ-to-XML. The only problem is that there is no direct or obvious method for converting a Xm...
Permissive asked 14/7, 2014 at 19:5

4

Solved

Please consider this XElement: <MySerializeClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <F1>1</F1> <F2>2</...
Killigrew asked 7/7, 2014 at 10:38

6

Solved

Consider the following XML: <response> <status_code>200</status_code> <status_txt>OK</status_txt> <data> <url>http://bit.ly/b47LVi</url> <ha...
Pb asked 4/9, 2010 at 15:19

2

Solved

I'm using an XDocument to build an Xml document in a known structure. The structure I am trying to build is as follows: <request xmlns:ns4="http://www.example.com/a" xmlns:ns3="http://www.examp...
Ricciardi asked 12/8, 2009 at 10:25

7

Solved

I have an xml file that contains its element like <ab:test>Str</ab:test> When I am trying to access it using the code: XElement tempElement = doc.Descendants(XName.Get("ab:test"))...
Proptosis asked 4/4, 2010 at 19:6

2

I have an application that is sensitive to a carriage return being \r\n or \n. I'm passing around a value in XML and when I parse it using XDocument the carriage retrun value is being converted to ...
Macegan asked 3/3, 2010 at 6:32

2

Solved

I have source code of Entlib 5.0 and I need sign all assemblies using my own key (snk file). The easiest way would be to open the EnterpriseLibrary.2010 solution file in Visual Studio 2010 and for...

4

Solved

I have an xml file that returns a set of elements that are unique by a attribute value. This presents a problem, as I can not select a node by its name: <doc> <float name="score&quot...
Bodywork asked 25/10, 2011 at 16:26

6

Solved

I am using this XML file: <root> <level1 name="A"> <level2 name="A1" /> <level2 name="A2" /> </level1> <level1 name="B"...
Sideling asked 22/3, 2009 at 4:48

4

Solved

What are the possible exceptions that can be thrown when XDocument.Load(XmlReader) is called? It is hard to follow best practices (i.e. avoiding generic try catch blocks) when the documentation fai...
Ritualist asked 1/8, 2011 at 21:49

8

Solved

I am new to LINQ to XML. After you have built XDocument, how do you get the OuterXml of it like you did with XmlDocument?
Glycolysis asked 26/12, 2010 at 11:7

3

I am querying a xml document using the XPathSelectElement method. if the node does not exist I would like to insert a node with that path in the same document. The parent nodes should also be crea...
Swansdown asked 18/8, 2011 at 18:32

8

Solved

I am working on a small project that is receiving XML data in string form from a long running application. I am trying to load this string data into an XDocument (System.Xml.Linq.XDocument), and th...
Bk asked 12/5, 2009 at 19:6

4

Solved

I would like to query an XDocument object for a given path, (e.g. "/path/to/element/I/want") but I don't know how to proceed.
Penile asked 27/6, 2012 at 10:52

3

Solved

I'm trying to validate an Xml fragment using an Xml Schema with the XDocument.Validate extension method. Whenever an invalid Xml fragment is used the ValidationEventHandler fires properly, however ...
Rawdon asked 9/1, 2012 at 18:46

4

Solved

There is a similar question, but it seems that the solution didn't work out in my case: Weirdness with XDocument, XPath and namespaces Here is the XML I am working with: <?xml version="1.0" en...
Cogwheel asked 2/6, 2011 at 2:40

9

Solved

Is there any way to get the xml encoding in the toString() Function? Example: xml.Save("myfile.xml"); leads to <?xml version="1.0" encoding="utf-8"?> <Cooperations> <Cooperatio...
Tuft asked 4/8, 2009 at 17:50

3

Is it possible to get the path of the current XElement in an XDocument? For example, if I'm iterating over the nodes in a document is there some way I can get the path of that node (XElement) so th...
Dauntless asked 5/5, 2011 at 20:54

6

Solved

i am using linq-to-xml to search elements. var doc = XDocument.Load(reader); var ns = doc.Root.Attribute("xmlns").Value; var result = (from u in doc.Descendants(XName.Get("MyElement", ns)) i...
Lindahl asked 24/4, 2012 at 12:56

7

Solved

Is there a way to search an XDocument without knowing the namespace? I have a process that logs all SOAP requests and encrypts the sensitive data. I want to find any elements based on name. Somethi...
Zoroastrian asked 9/4, 2010 at 21:9

3

Solved

I have an XML <data> <summary> <account curr_desc='USD' acct_nbr='123' net='1000.00' /> <account curr_desc='USD' acct_nbr='456' net='2000.00' /> </summary> <d...
Cylindrical asked 25/4, 2011 at 16:14

© 2022 - 2024 — McMap. All rights reserved.