Hi,
I have few questions on XML serialization and LINQ to XML.
When do we use XML Serialization and LINQ to XML? Please specify the kind of situations or scenarios to use XML Serialziation and LINQ to XML.
What are the differences between XML Serialization and LINQ to XML?
What are the benefits of using XML Serialziation over LINQ t...
I have a xml file with following entries, I want to update. I have gone through other related questions but not solving my issue.
<Movie>
<Name>21</Name>
<Year>2008</Year>
<Genre>Drama</Genre>
</Movie>
...
Hi there,
I want to create a list out of an xml file where only values between two letters are displayed. For example, only show matching records where the first character of the title are in the range from "A" to "E".
My first basic approach was
where item.Element("title").Value >= "A" && item.Element("title").Value < "E"
Of cours...
I am trying to write a app.config / web.config error correcting app that will audit our developers applications for incorrect environment settings. I am using Linq to XML to accomplish this and I am hitting a snag.
var query =
from el in doc.Descendants().Element("SMTPHost")
select el;
foreach (XElement host in query)
{
...
I'm building a small application and to reduce hosting costs and dependencies, I am planning to store all persistent data to xml files rather than a Sql Server database.
In this case, the site audience is limited to friends and family - no more than a few concurrent users are ever expected, so the site does not need to scale. Is it fea...
Hello,
I'm working on a program that needs to be able to load object-properties from an XML file. These properties are configurable by the user and XML makes sense to me to use.
Take the following XML document.
<?xml version="1.0" encoding="utf-8" ?>
<udpcommands>
<command name="requser">
<cvar name="reqchallege" value="false"...
I have a function that works great in C# that I'm converting to VB.Net. I'm having an issue converting the result set to a generic list in VB.net.
The code:
Public Function GetCategories() As List(Of Category)
Dim xmlDoc As XDocument = XDocument.Load("http://my_xml_api_url.com")
Dim categories = (From category In xmlDoc.Descendan...
Is there anything you can do in XSLT that can't be done in LINQ to XML? Is it still important to learn XSLT? When would you choose one over the other?
...
In my table I am having my client Id as
Actual Input:-
<client>
<ClientId>421</ClientId>
<Amount>100</Amount>
<client>
<client>
<ClientId>426</ClientId>
<Amount>200</Amount>
<client>
<client>
<ClientId>421</ClientId>
<Amount>300</Amount>
<client>
<client>
<ClientId>427</ClientId>
<Amount>400</Amount>
<c...
I'm working against a 3rd party xml api. They have defined a required xml structure similar to the following.
<ns1:E xmlns:ns1="schema">
<ns1:B>
<ns2:S>
<ns2:V>
<ns2:Bl />
</ns2:V>
</ns2:S>
</ns1:B>
</ns1:E>
There is a SQL table with the information that I need to put into this xml format. I have a LINQ to SQL adapter to ge...
So I'm trying to parse some XML from the twitter API and for some reason the LINQ query below only returns 1 row. When I step through the code to view the raw XML it's the usual 20+ items so I'm not sure what I'm doing wrong here.
Any help for a LINQ to XML newbie?
List<TwitterStatus> StatusCollection = new List<TwitterS...
Is there a way to determine if an XElement contains one of any specified elements? For example, I have XElements that I'll want to check:
Dim xe1 = <color><blue/></color>
Dim xe2 = <color><red/></color>
Dim xe3 = <color><powderBlue/></color>
Dim xe4 = <color><aqua/></color>
Dim xe5 = <color><green/></color>
I'd like to be able to quer...
I know this is most likly very basic and been asked a thousand times but for some reason I just can't get it to work.
I have a gml file that looks like the following:
<?xml version='1.0' encoding='UTF-8'?>
<schema
xmlns='http://www.w3.org/2000/10/XMLSchema'
xmlns:gml='http://www.opengis.net/gml'
xmlns:xlink='http://www.w3.org/1999/xlin...
I'm converting the Linq query below from C# to VB.Net. Can you spot my error? The query joins 3 XML datasets. Thanks in advance!
C# - This one works great.
List<Course> courses =
(from course in CourseXML.Descendants(ns + "row")
join coursecategory in CourseCategoryXML.Descendants("Table") on (string)course.Attribute("code") equals...
Can someone help with an explanation of what this means:
... .Select(Func<XElement, XElement>selector)
Please an example of what should go in as parameter will be appreciated.
Also found it a little bit difficult naming this question. Suggestion will also be appreciated.
...
How to implement IComparable to sort numerical and non-numerical string.
Firstly, I want to get the Min and Max value in the "list".
It is asking me to implement ICompareable. " At least one object must implement IComparable"
Can anyone help me? Here is my code:
// setup
string filePath1 = Directory.GetCurrentDirector...
This may be a simple fix (well, it probably is) but for some reason I just can't figure it out.
So, I have some xml that looks something like this:
XElement xml = XElement.Parse (
@"<Alphabet>
<a name="A" />
<b name="B" />
<d name="D" />
<e name="E" />
</Alphabet>");
So later in my code, I reference a node that ma...
Hi I am new to LINQ
I have an xml in the following format
"<root>"
"<page>"
"<title>text</title>"
"<text attrib1="1">some text</text>"
"<text attrib1="2">some text</text>"
"<text attrib1="3">some text</text>"
"<text attrib1="4">some text</text>"
"</page>"
"<page>"
"<title>text</title>"
"<text attrib1=...
If I want to work with XML, I usually design a class/bunch of classes that represent the data I need. Then I use XmlSerializer to read in the XML and write it out again.
This gives me strongly typed classes to work with whilst the XML is "in memory".
I can of course use Linq on these classes without any issue.
Should I be using Linq t...
So, I've got a small chunk of stabby, pointy xml that looks like this:
<Groups UseGroup='True'>
<Group>1264,182,1979</Group>
</Groups>
And I've got a small chunk of linq that gets the value from that looks like this:
var group = from a in xml.Descendants("Groups")
select a.Element("Group").Value;
It's all fine and dandy...