I am attempting to bind linq-to-xml query to a gridview.
I have the following XML
<?xml version="1.0" encoding="utf-8" ?>
<thesaurus xmlns="x-schema:tsSchema.xml">
<diacritics_sensitive>0</diacritics_sensitive>
<expansion>
<sub>satellite navigation</sub>
<sub>sat-nav</sub>
<sub>Sat Nav</sub>
<sub...
Hi all,
I have a xml file on which I want to make a query to display all articles with certain Id's in it.This is what I tried but somehow I can't get it to work.
I looked around and all I could find were examples using linq to sql.
Any help would be appreciated...
Cheers,
Terry
The id's are stored like this in the xml
<relatedconte...
Hi,
I'm using LINQ to XML to search the XML below (small section of final document) initially on the Country name attibute and was wondering if there would be any performance benefit in creating the name as a child element rather than attribute
<Countries>
<Country name="United Kingdom">
<Grades>
<Grade>PA</Grad...
I've ran into a problem and wondered if there's simple way of solving it.
Here I have a XML template, defining some properties and their values.
<Properties>
<Property name="ID">10000</Property>
<Property name="Name">
<SubProperty name="FirstName">Foo</SubProperty>
<SubProperty name="LastName">Bar</SubProperty >
</Propert...
Hey guys,
I'm trying to get all nodes from an XElement that actually has a value,
currently I'm using this code:
var nodes = from node in elem.Nodes()
where node.NodeType == XmlNodeType.Element &&
((XElement) node).Value.Length > 0
select node;
Is there a build in operator to do this operati...
I get a NotSupportedException when I parse the following string with an XElement:
<ref>S. L. Vartanyan*, V. E. Garutt† & A. V. Sher‡parallel, "Holocene dwarf mammoths from Wrangel Island in the Siberian Arctic", Nature 362, 337 – 340 (25 March 1993) [http://www.nature.com/nature/journal/v362/n6418/abs/362337a0.html Nature.com]</ref...
I am trying to improve some code and I can't think of a better way to do what it currently does. essentially i loop outside for the number of items divided by the number I want to select, then inside that loop I select the item based on an inner loop of the number of items I need to create a single item modifying that by the outerloop va...
I'm pretty new to Linq to SQL & Linq to XML but have cobbled together some code together that put the XML results from a stored proc into an XElement. However, it's started failing, apparently now that the XML data is getting larger (2K+) and my .Parse is reading truncated XML (the XML data comes back in two rows). Before i start fumblin...
Hi,
I'm trying to insert an element at a specific point within my file, then save that file out. However, I can't seem to get it right. My XML layout is like this:
<?xml version="1.0" encoding="utf-8"?>
<Settings>
<Items />
<Users />
</Settings>
This is my current code:
XDocument xd = XDocument.Load(@"C:\test.xml...
Here's the sample XML
<?xml version="1.0" encoding="utf-8" ?>
<Instructions>
<Instruction>
<Brand>Brand1</Brand>
<Text>
this is text for Brand1
</Text>
</Instruction>
<Instruction>
<Brand>Brand2</Brand>
<Text>
Brand2 text is slightly different
</Text>
</Instruction>
<Instruction>
<Brand>...
For an XDocument descendants operation how can only return immediate child nodes?
I have an operation along the lines of:
XDocument xmlDc = XDocument.Load(dependencyFilePath);
IEnumerable<IGrouping<string, XElement>> scriptNodes =
from s in xmlDc.Descendants("script") select s;
The problem is my XML doc is structured as follows
...
I have this XML file of size 2.8GB (Polish Wikipedia dump). I have to search this file for certain title and get page content for it. I use LINQ to XML for simplicity:
var text = from el in StreamXmlDocument(filePath)
where el.Element("title").Value.Contains(titleToSearch)
select (string)el.Element("revision").Elem...
hi.,
this is my xml file
<Persons>
<Person>
<id>1</id>
<Name>Ingrid</Name>
</Person>
<Person>
<id>2</id>
<Name>Ella</Name>
</Person>
</Persons>
i am using linq xml.
here the id should be auto-generated..
i need to check if the value of node id already exists .
if not exists it should create a new id..how t...
var geoSettings = (from c in geoFields.Elements("Maps").Elements("Map")
select new
{
loc = c.Element("Location").Value
}).Distinct().Intersect(from p in terrainFields.Elements("Maps").Elements("Map")
...
Im trying to parse the following XML using LINQ-to-SQL but visual studio doesn't seem to want to play ball. I've tried using XElement and XDocument and tried selecting from the root node or the api_item node directly, but doesn't seem to happen for me.
Can anyone advise a bit of LINQ-to-XML?
I've tried the following (and many variation...
Hi,
I am trying to generate a xml document using LinqXml, which has the "\n" to be "& #10;" in the XElement value, no matter whatever settings I try with the XmlWriter, it still emits a "\n" in the final xml document.
I did try the following, Extended the XmlWriter.
Overrided the XmlWriterSettings changed the NewLine Handling.
Both of t...
I have an xml mapping file that looks something like this
<colourMappings>
<model name="modelX">
<mapping colour="White" configCode="1"></mapping>
<mapping colour="Aluminium" configCode="2"></mapping>
<mapping colour="Black" configCode="3"></mapping>
<mapping colour="Blue" configCode="4"></mapping>
...
hello.,
how to sort nodes in the xml file and save file in sorted order using linq?
if this is my xml file,
<Persons>
<Person>
<id>2</id>
<Name>xxx</Name>
</Person>
<Person>
<id>3</id>
<Name>yyy</Name>
</Person>
</Persons>
when inserting new node.,
it should be inserted as like this.
<Persons>
<P...
I have a XML file on which when I run a LINQ query returns nothing in the for loop.
<?xml version="1.0" encoding="utf-8"?>
<ReadOrderResponseType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Status xmlns="urn:mysite:apis">Success</Status>
<TimeStamp xmlns="urn:mysite:apis">201...
I am generating a dynamic sitemap.xml
According to sitemaps.org this is the header for a sitemap.xml
<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmln...