linq-to-xml

Linq 2 xml: How to retrieve web methods' names from a wsdl document?

I have a XML documents (which describes a wsdl service's interface): <?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/m...

Populating Domain Objects from XML using LINQ to XML

I am new to LINQ to XML and need help in mapping an XML hierarchy into my domain object. Here is the XML source: <?xml version="1.0" encoding="UTF-8"?> <Listings> <Region>United States</Region> <Listing> <CatID>ELE</CatID> <CatDesc>Electronics</CatDesc> <ItemID>ELE_LCDTV</ItemID> <ItemDesc>LCD TV ...

Linq XML - create complex types

Hello, I have no firm idea how to word this question, so forgive me if I don't use the correct terminology. I have a System.Xml.Linq.XElement el which contains an xml document. I want to query a part of the XElement and add user objects (Upload) to a generic list (UploadList held in a page property) like so: this.UploadsList.Add((from ...

How to query Min and Max from XML?

<?xml version="1.0" encoding="utf-8"?> <Customers> <Customer Id="1"> <Name>rtertr</Name> <DOB>2010-12-12T00:00:00</DOB> <EMail>[email protected]</EMail> </Customer> <Customer Id="2"> <Name>west</Name> <DOB>0001-01-01T00:00:00</DOB> <EMail>[email protected]</EMail> </Customer> <Customer Id="3"> <Name>west...

How to search for a set of node using search criteria using Linq to SQL?

I have this XML <?xml version="1.0" encoding="utf-8"?> <Customers> <Customer Id="1"> <Name>rtertr</Name> <DOB>2010-12-12T00:00:00</DOB> <EMail>[email protected]</EMail> </Customer> <Customer Id="2"> <Name>west</Name> <DOB>0001-01-01T00:00:00</DOB> <EMail>[email protected]</EMail> </Customer> <Customer Id="3...

Problem creating an XElement object with GML namespace

I am trying to build a XML document using the GML namespace and XML to LINQ. My goal is an XElement with contents like this: <gml:name>...</gml:name> But I get the following: <name xmlns="http://www.opengis.net/gml" /> The problem is that the gml: is missing from the element. Why is that? My code is as follows: XNamespace ns...

Convert Resultant Values to List of Strings in Linq

I'm having issues with returning a list of strings of the .Value of a Linq query: Dim details = <Details> <Vector size="5"> <Item>Syntactic Structures</Item> <Item>Introduction</Item> <Item>The Independence of Grammar</Item> ...

Linq-to-XML: Adding enumerations to objects

I'm trying to figure out how to add an enumeration to an object with Linq. For example: Dim thingBlock = <Things> <Thing Name="Ish"> <SmallThing>Jibber</SmallThing> <SmallThing>Jabber</SmallThing> </Thing> <Thing Name="U...

LINQ to SQL to XML (using XML literals in C#)

Is it possible to use variables like <%=person.LastName %> in XML string this way? XElement letters = new XElement("Letters"); XElement xperson = XElement.Parse("<Table><Row><Cell><Text> <Segment>Dear <%=person.Title%> <%=person.FirstName%> <%=person.LastName%>, </Segment></Text></Cell></Row>..."); foreach (Person person in pers...

LInq to XML question

Possible Duplicate: How to query an XDocument with LINQ when elements have a colon in their name? I tried using XDocument to read a xml file that contains elements like this <link:direct ...> running the code xml.Elements("link:direct") gives me an error saying that I cannot use ':' The ':' character, hexadecimal value ...

A simple query on LINQ

var q = from child in doc.Descendants("level") where (int)child.Attribute("id") == 55 select (string)child.Element("Points").**Value.ToString()**; I would like to get q as a type string after executing this query. Even after keeping the extra bolded line this is giving me some IEnumerable type. Well let me put it this ...

Double escape XML File

Hi! I have a simple xml file like this one: <xml> <check> <a>b&lt;</a> <b> <test>asdf</test> </b> <test>jj&amp;j</test> </check> </xml> I would like to "double escape" all special chars so it will result in &amp;lt; and &amp;amp; with a simple linq to xml statement. The xml should still be valid, only the v...

From a list of child elements take just one from the middle

Greetings, I have a problem and a deadline (I just know there are some knowing nods at that plight) Background: I had a need to store data elements in an hierarchical nature. In a nutshell my xml is a set of rules that instruct a graphical drawing engine to draw a number of series on a chart according to a strict parent child relations...

How do I convert this XPath query to LINQ to XML?

I have some data which looks like: <data> <row> <v>0.0264</v> <v>1073655665.0000</v> <!-- select this --> <v>1073749988.0000</v> </row> <row> <v>0.0056</v> <v>1073655714.0000</v> <!-- select this --> <v>1073751235.0000</v> </row> <row> <v>0.0052</v> <v>1073655812.0000</v> <!-- select this --...

How can I transform a List<string> into XML using Linq ?

The inverse question of How can I transform XML into a List or String[]?. I have a List<string> of users and want to convert them to the following xml : <Users> <User>Domain\Alice</User> <User>Domain\Bob</User> <User>Domain\Charly</User> </Users> I am currently wrapping this list in a class and use XmlSerializer to solve ...

i'm trying to work with xml linq xdocument in vb.net

I'm trying to write a windows phone 7 app which reads from an xml using xdocument but i'm having a few problems. If I do this: Dim xml As XDocument = XDocument.Load(e.Result) System.Diagnostics.Debug.WriteLine(xml.ToString) Or this: System.Diagnostics.Debug.WriteLine(xml.Elements.Value.ToString) then the xml data is output to the ...

XElement not declared when using Service Reference Proxy with XmlAnyElementAttribute

I am working on a Windows Phone 7 app that talks to a 3rd party Soap service. I used 'Add Service Reference' to the wsdl to generate the proxy class. Some calls work, but certain outbound calls that make use of an 'sObject' class result in the error "The type System.Xml.Linq.XElement was not expected. Use the XmlInclude or SoapInclude at...

Linq to XML...I never get any Descendent values with XML as-is

Here is part of the xml I am trying to parse: <?xml version="1.0" encoding="UTF-8"?> <Workflow xmlns="http://soap.sforce.com/2006/04/metadata"&gt; <alerts> <fullName>Broker_Not_In_SF_Current_Broker_Account</fullName> <description>Broker Not In SF - Current Broker Account</description> <protected>false</protec...

Select element with given attribute using linq to xml

I've got following xml structure: <artists> <artist> <name></name> <image size="small"></image> <image size="big"></image> </artist> </artists> I need to select name and image with given attribute (size = big). var q = from c in feed.Descendants("artist") select new { name = c.Element("...

equivalent lambda expression for this query expression.

As per post http://stackoverflow.com/questions/3885795/select-element-with-given-attribute-using-linq-to-xml what will be the equivalent lambda expression. The below solution works fine var artistsAndImage = from a in feed.Descendants("artist") from img in a.Elements("image") where img.Attri...