Reading an article called "Increase LINQ Query Performance" in Jully's MSDN magazine, the author states that using an Imports in VB providing a path to schema in the current project will turn IntelliSense on for XElement. In the code provided, he uses statements like xelement.@name to retreive attributes values, and so on.
I did not try...
I have an object graph serialized to xaml. A rough sample of what it looks like is:
<MyObject xmlns.... >
<MyObject.TheCollection>
<PolymorphicObjectOne .../>
<HiImPolymorphic ... />
</MyObject.TheCollection>
</MyObject>
I want to use Linq to XML in order to extract the serialized objects within the TheCollect...
If I have an XElement that has child elements, and if I remove a child element from the parent, removing all references between the two, will the child XElement have the same namespaces as the parent?
In other words, if I have the following XML:
<parent xmlns:foo="abc">
<foo:child />
</parent>
and I remove the child element, will...
Greetings!
I'm working on wrapping my head around LINQ. If I had some XML such as this loaded into an XDocument object:
<Root>
<GroupA>
<Item attrib1="aaa" attrib2="000" />
</GroupA>
<GroupB>
<Item attrib1="bbb" attrib2="111" />
<Item attrib1="ccc" attrib2="222" />
<Item attrib1="ddd" attrib...
Greetings!
I'm working on wrapping my head around LINQ. If I had some XML such as this loaded into an XDocument object:
<Root>
<GroupA>
<Item attrib1="aaa" attrib2="000" attrib3="true" />
</GroupA>
<GroupB>
<Item attrib1="bbb" attrib2="111" attrib3="true" />
<Item attrib1="ccc" attrib2="222" attrib3=...
I'm a LINQ to XML newbie, and a KML newbie as well; so bear with me.
My goal is to extract individual Placemarks from a KML file. My KML begins thusly:
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="http://earth.google.com/kml/2.0">
<name>Concessions</name>
<visibility>1</visibility>
<Folder>
<visibility>1</visib...
I'm trying to extract the polygons from placemarks in a KML file. So far so good:
Imports <xmlns:g='http://earth.google.com/kml/2.0'>
Imports System.Xml.Linq
Partial Class Test_ImportPolygons
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ...
I need to replace the contents of a node in an XElement hierarchy when the element name and all the attribute names and values match an input element. (If there is no match, the new element can be added.)
For example, if my data looks like this:
<root>
<thing1 a1="a" a2="b">one</thing1>
<thing2 a1="a" a2="a">two</thing2>
<thing2 ...
Is there any way to output the contents of an XDocument without the BOM? When reading the output with Flash, it causes errors.
...
I am creating a small application that will be deployed on Window. The database will have less than 10 tables.
Instead of installing a database on the client box is using XML documents for the database and LINQ going to cost in performance of queries, waiting for the XML file to be loaded and be written?
If I use a database I will ...
I would like to use Linq to Xml to get a single XElement from a .xml file by attribute name, similar to how you retrieve single objects in Linq to Sql by Id below:
var singleDog = context.Dogs.Single(p => p.Id == int.Parse(Id));
Is this possible?
...
Any XPath like /NodeName/position() would give you the position of the Node w.r.t it's parent node.
There is no method on the XElement (Linq to XML) object that can get the position of the Element. Is there?
...
Lets assume we have this xml:
<?xml version="1.0" encoding="UTF-8"?>
<tns:RegistryResponse status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure"
xmlns:tns="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
<tns:RegistryErrorList highestSeverity="">
<tn...
Hi
I am trying to get some XML data with LINQ, but running into a problem.
I am using a schema, which is set in the attribute xmlns ...
<CarsForSale xmlns="http://schemas.sharplogic.net/CarSales.xsd">
<CarForSale>
There are many CarForSale elements.
When the schema is set and I do this...
XElement doc = XElement.Load(HttpCont...
I have a project where I am taking some particularly ugly "live" HTML and forcing it into a formal XML DOM with the HTML Agility Pack. What I would like to be able to do is then query over this with Linq to XML so that I can scrape out the bits I need. I'm using the method described here to parse the HtmlDocument into an XDocument, but...
How can i use linq to xml in F# to extract all specific tags from an XML file.
Open the file
let Bookmarks(xmlFile:string) =
let xml = XDocument.Load(xmlFile)
Once i have the XDocument how can I navigate it using Linq to XML?
can someone point me in the right direction ?
Edit: Part of my solution
let xname (tag:string) = XNam...
I have this XML in a column in my table:
<keywords>
<keyword name="First Name" value="|FIRSTNAME|" display="Jack" />
<keyword name="Last Name" value="|LASTNAME|" display="Jones" />
<keyword name="City" value="|CITY|" display="Anytown" />
<keyword name="State" value="|STATE|" display="MD" />
</keywords>
I'm getting a record out...
I want to make a deep copy of a LINQ to XML XElement. The reason I want to do this is there are some nodes in the document that I want to create modified copies of (in the same document). I don't see a method to do this.
I could convert the element to an XML string and then reparse it, but I'm wondering if there's a better way.
...
I'm perhaps being a bit lazy asking this here, but I'm just getting started with LINQ and I have a function that I am sure can be turned into two LINQ queries (or one nested query) rather than a LINQ and a couple of foreach statements. Any LINQ gurus care to refactor this one for me as an example?
The function itself loops through a lis...
The following Code does not compile
Dim BasicGroups As String() = New String() {"Node1", "Node2"}
Dim NodesToRemove = From Element In SchemaDoc.Root.<Group> _
Where Element.@Name not in BasicGroups
For Each XNode In NodesToRemove
XNode.Remove()
Next
It is supposed to Remove any Immediate child of the rootnode w...