Hello everyone, I'm new to Linq and having some strange results when I try to perform a query using where.
Example of the xml:
<movies>
<movie id="1">
<scenes>
<scene id="1">
<sceneartistsnames>
<sceneartistname>Artist A</sceneartistname>
</sceneartistsnames>
<...
I have got to convert a PDF to a Base64 Encoded and write it to a element in a XML file.
I have got the Base64 Encoded string (very long/big) but the spec im working from says the following:
This has been chosen, to ensure the XML file may be displayed and validated without any potential
problems caused by the handling of the raw binary...
If I have code like this (C# or VB.Net does not matter)
Dim e As IEnumerable(Of XElement) = _
From s In _dataSourceSettings.Elements _
Where s.Attribute("name").Value = toInsert.Attribute("name").Value
If e.Count > 0 Then
e.Remove()
End If
How do I get now new _dataSourceSettings w...
What is the VB.NET syntax for these? Any help converting would be greatly appreciated.
var defaultStyleName = (string)doc
.MainDocumentPart
.StyleDefinitionsPart
.GetXDocument()
.Root
.Elements(w + "style")
.Where(style =>
(string)style.Attri...
I have an XML document as follows:
<Database>
<SMS>
<Number>"+447528349828"</Number>
<Date>"09/06/24</Date>
<Time>13:35:01"</Time>
<Message>"Stop"</Message>
</SMS>
<SMS>
<Number>"+447528349828"</Number>
<Date>"09/06/24</Date>
<Time>13:35:01"</Time>
<Message>"Stop"</Message>
</SMS>
</Database>
I am t...
I have some xml data contained in three files (Database.xml, Participants.xml, and ConditionTokens.xml). I am trying to use external entities to place the participants and condition tokens into the database file, but when I run this code...
string xmlPath = Environment.CurrentDirectory + @"\Data\Database.xml";
XElement database = XEleme...
I have this (XLinq) query and was wondering how to convert it to the query syntax:
var grouped = doc.Descendants()
.GroupBy(t => t.Element(ns + "GroupingAttr").Value, StringComparer.OrdinalIgnoreCase);
This is the query syntax without the StringComparer:
var grouped = from t in doc.Descendants()
group t...
Use XML files based or SQL server? Which would be more efficient based on storage size, retrieval and performance?
...
Hi there,
I was writing a generic class to read RSS feed from various source and to consolidate in one collection of object in VB.net.
Basically the function - using LINQ to XML - is working properly, but I have a problem when the RSS feed I am trying to read does not contain one of the node (as you know, many of them are optional). I w...
So I took a specific hot-spot from a very large web application, that does lot of XML processing (adding nodes, adding attributes to nodes based on some logic), then created a standalone test to mock the same situation using Linq to XML (as opposed to XmlDocument)
There was 2 to 10 times performance improvement in the standalone test co...
I try to use the domainpeople.com API and to do I need to use XML.
Currently I have an error saying "apiProtocol is not found" I guess then that my Xml document is malformed.
The Current xml sent is :
<apiProtocol version="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNameSpaceSchemaLocation="checkrequest.xsd">
<ch...
Hi,
I'm trying to get the .NET object representation of a certain XSD(element) at runtime.
How can I use Linq to XSD to do that in runtime as opposed to design time?
Thanks,
--Ran.
...
I'm basically brand new to LINQ. I've looked around a lot on here and am pretty confused. I've seen some examples that allow me to strong type objects using LINQ but I don't really understand them because they're in C#, which I guess lets you do different things with LINQ(I think?).
Anyways, this is what I'm trying to do:
Dim productXM...
What advantages are there for using either XSLT or Linq to XML for HTML parsing in C#? This is under the assumption that the html has been cleaned so it is valid xhtml. These values will eventually go into a c# object to be validated and processed.
Please let me know if these are valid and if there are other things to consider.
XSLT...
I'm getting data out of an XML file by sending a where clause as delegate to a custom method:
foreach (PageItem pageItem in GetPageItems(xmlDoc, sf => (int)sf.Element("id") == id))
{
_collection.Add(pageItem);
}
which works fine but now I want to add an OrderBy clause as well, but can't get the right syntax, here it doesn't recogn...
Let's say I have the following XML:
<Account>
<AccountExpirationDate>6/1/2009</AccountExpirationDate>
</Account>
I want to use LINQ to XML to parse this into an object I'll call Account:
public class Account {
public DateTime? AccountExpirationDate { get; set; }
}
This is the C# code I've tried, but it won't let me use ...
I am looking for more advanced alternatives to xsd.exe.
I am just about to start a fairly simple project and decided to try using LINQ2XSD.
The project has now been released as open source to CodePlex.
I'm just wondering how many people have attempted to use it, if there are any 'dealbreakers' or critical bugs in there.
I downloaded t...
I want to create a CLR Stored Procedure for SQL Server 2008 that references the System.Xml.Linq assembly. According to the documentation (http://msdn.microsoft.com/en-us/library/ms403279.aspx) this assembly is safe for use in SQL Server 2008.
However when I attempt to add a reference using Visual Studio 2008 (Team Suite with GDR R2 ins...
Hi
I have got this code:
XDocument xdoc = XDocument.Load(URI);
XElement root = xdoc.Element("forecast");
//get the values into objects
forecast = from fc in root.Descendants("simpleforecast").Elements("forecastday")
select new DayForcast
{
...
I've got a simple POCO class to hold data extracted from an XML file defined as follows:
public class Demographics
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string MiddleName { get; set; }
public string Gender { get; set; }
}
I've got a fairly straight-forward XML file (or rath...