I need to access Values under Address Tag using linq to Xml.
<p1:Person>
<p2:ID>1</p2:ID>
<p2:Name>Qwerty</p2:Name>
<p2:Address>
<p2:street>1111 abc</p2:street>
<p2:road # >9</p2:road #>
</p2:Address>
<p1:Person>
I wrote a query like this
ArrayList nodes = new ArrayList();
List<XElement> personNode = xml.Elements()...
Hi everyone,
I have an xml doc defined as
<Body>Stuff stuff stuff <FormatStuff> alsdkfafkafkaf </FormatStuff> </Body>
Now, this is apparently valid xml (which I wouldn't have guessed). I want to return just the information in Body, and a separate XElement for <FormatStuff>, so it would look like
Stuff, Stuff, Stuff
alsdkfafkafka...
I'm trying to do a dump to XML of a very large database (many gigabytes). I'm using Linq-to-SQL to get the data out of the database and Linq-to-XML to generate XML. I'm using XStreamingElement to keep memory use low. The job still allocates all available memory, however, before keeling over without having written any XML. The structure l...
<XMLDOC>
<OPTIONA>
<![CDATA[
aaaaaaaaaaaaa
]]>
<![CDATA[
bbbbbbbb]]>
<OPTIONA>
<OPTIONB>
<![CDATA[
cccccccccccccccccccc
]]>
<![CDATA[
dddddddddddddd]]>
</OPTIONB>
</XMLDOC>
How do I query say all CDATA's under OPTIONB?? using Linq-to-XML???
...
I have two module-level variables and Linq query. I want the results of the Let clause to change the global variables - is this possible?
For example:
Dim X As Integer = 0
Dim Y As Integer = 0
Sub One()
Dim query = From e In <picture> _
Let X = e.@x _
Let Y = e.@y _
Select <im...
IBM only provides a database connection to the iSeries, thus I have to work around this issue with using a table to pass data from the iSeries to .NET. The RPGLE program creates an XML document in a table for processing on the .NET side. The thing is that on one record in the table has one line of the XML document.
To help visualize pr...
Hello!
I want to downgrade a Windows Mobile application made with .Net Compact Framework 3.5 to .Net Compact Framework 2.0 SP2.
But... I don't know how to make this piece of code compatible with version 2.0.
XDocument doc = XDocument.Load(string.Format(Open_Cell_Id_Uri, new object[]{
Settings.OpenCellIDApiKey,
towerDetails.Mob...
I can't quite get my query correct. Given this XML:
<?xml version="1.0" encoding="utf-8" ?>
<FileTypes>
<File type="photo">
<Extension>.jpg</Extension>
<Extension>.gif</Extension>
</File>
<File type="document">
<Extension>.pdf</Extension>
</File>
<File type="video">
<Extension>.flv</Extension>
</File>
</FileT...
Hi there,
I am trying to read an RSS feed using C# and Linq to XML.
The feed is encoded in utf-8 (see http://pc03224.kr.hsnr.de/infosys/feed/) and reading it out generally works fine except for the description node because it is enclosed in a CDATA section.
For some reason I can't see the CDATA tag in the debugger after reading out th...
I've tried searching on this but can't seem to find an answer anywhere, so hopefully someone here can help. I want to insert an conditional XML tag based on whether or not a count is above one, but am not sure how to do it.
For example, I have two XElements that are like this:
<Blob>
<Group>
Stuff 1
</Group>
</Blob>
and
<Blob>
<Gro...
When I use LINQ to XML, is the order of the elements and attributes written out to text guaranteed to be the same order as how I added the XElement and XAttribute objects? Similarly, when I read in an XML document, is it traversed in the same order as it appears in the XML?
...
I have xml files with following to generate the menu for our web site.
<xs:element name="Menu">
<xs:complexType>
<xs:sequence>
<xs:element name="MenuItem" type="MenuItemType" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="Title" type="xs:string"></xs:attribute>
<xs...
My XML Document is as below -
<?xml version="1.0" encoding="utf-8"?>
<Parents>
<Parent id="A" description="A is a parent">
<Children>
<ChildName name = "Son1ofA" />
<ChildName name = "Son2ofA" />
</Children>
</Parent>
</Parents>
Requirement -
To identify the Element "Parent", clone it. Change the attr...
I wrote this simple linq-to-xml query and it seems that null exception could not be avoided using the the linq syntax. Am I using it wrong? What should be the right (and short) Linq2Xml syntax?
The linq2Xml query
var userData =
queryUserResponseData.Elements("user")
.Single(u => u.Element("username").Value == userName);
T...
I would like to traverse every element and attribute in an xml and grab the name an value without knowing the names of the elements in advance. I even have a book on linq to xml with C# and it only tells me how to query to get the value of elements when I already know the name of the element.
The code below only gives me the most high ...
Where can i get more examples on Linq to Xml?
...
Hi
I need to select rows from database table using filtering by xml-type column.
table looks like (short version)
id
dbfield int
xmlfield xml
and i'm filtering it in this way
IQueryable<Data.entity> q = from u in datacontex.entities
select u;
if (val1.HasValue)
q = q.Where( x => x.dbfield > val1.value)
if (val2.HasValue)
q = ...
I would like to ask a follow up question to an oldie (but goodie) Reading the list of References from csproj files (though I am not the author of that question).
In my parsing of the csproj files I need to select all Compile elements that have Link element as a child.
I first attempted to extend the answer to the linked question as fol...
I am working with Linq to Xml to manipulate openXml documents. More precisely I am trying to read and write to the documents custom properties. I am currently having a problem appending a prefix onto an XElement. My code looks like:
Dim main as XNameSpace = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
Di...
do you know any sample or real application whose data are beyond simple entities? I need something complex, more or less a mirror of a relational database into xml.
Making sharper my idea, I'm looking for an XmlDataProvider or an implementation of Repository Pattern only for Xml (hierchical) data. Let's say a translation of Implementing...