I'm experimenting with using Google Checkout and am having a problem posting to the checkout server. Here is my code:
XNamespace ns = XNamespace.Get("http://checkout.google.com/schema/2");
XDocument cart = new XDocument();
XElement rootElement = new XElement(ns + "checkout-shopping-cart",
new XElement("shopping-cart",
new ...
Hello,
Given this xml:
<?xml version="1.0" encoding="utf-8"?>
<EntityDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<components>
<component xsi:type="TypeA">
<Property1>100</Property1>
</component>
<component xsi:type="TypeB">
<Property2>100</...
Hi,
What is the "best" way to search in xml?
Xpath or Linq2xml.
I'm asking this because we need to do a lot of searching in xml.
I'm always using XPath (since I've been using this from .NET 1.1). But with the introduction of Linq you can easely use Linq2Sql.
Regards,
M.
...
This snippet is from this answer
var reports = from report in xml.Descendants("report")
where report.Element("name").Value.Contains("Adjustment Report")
select new {
Name = report.Element("name").Value,
Extension = report.Element("extension").Value,
FileType = report.Element("filetype").Value,
Fi...
Book List
XSLT Programmers Reference
Michael Kay
from the given Xml document,I want to iterate all <blist:books> elements.
(i.e)
How to i handle the namespace ?
i tried
XNamespace blist = XNamespace.Get("http://www.wrox.com/books/xml");
XElement element = XElement.Load("Books....
var subset = from item in document.Descendants("Id")
where item.Value == itemId.ToString()
select new PurchaseItem() {
Id = int.Parse(item.Parent.Element("Id").Value),
Name = item.Parent.Element("Name").Value,
Description = item.Parent.Element("Description").Val...
I'm transforming some XML from DrawingML to XAML. Unfortunately, the XAML one is not working as expected with white spaces, but I have found a work around. Here's the problem:
Problem Statment
I want to write the following in a TextBlock:
Hi John, what did Sushi A say to
Sushi B?
So I would write:
<TextBlock>
<Run>Hey</Run>
...
Here is a snippet of my (VB) LINQ:
From event_evn In xmlEvents.Descendants("event_evn") _
Join genre_gnr In xmlGenre.Descendants("genre_gnr") On event_evn.Element("evn_gnr_id") Equals genre_gnr.Element("gnr_id").Value _
Group Join eventdata_eda In xmlEventData.Descendants("eventdata_eda") On _
eventdata_eda.Element("eda_evn_id").Value E...
I am having trouble wrapping my mind around how to do this in linq.
How can i convert this:
<mytags>
<tag1>hello</tag1>
<tag2>hello</tag2>
<tag1>MissingTag</tag1>
<tag1>Goodbye</tag1>
<tag2>Goodbye</tag2>
</mytags>
to this
List<MyObject>
public class MyObject
{
public tag1;
public tag2;
}
...
hi i have an xml file. i am unable to perform any XLINQ query on this xml..
i also used LINQPad to test. but it is not returning any result:(
sample query
XDocument doc = XDocument.Load(@"G:\Plugins.xml");
var res = from plugin in doc.Descendants("Modules")
select plugin;
res.Dump();
and xml file is
<Sol...
hi.
i am generating an xml file using XDocument. when i save this file it adds
<?xml version="1.0" encoding="utf-8"?>
at the top of xml..
i want to exclude this before saving
how can i do that.
...
hi. i am facing one problem
i have two xml files.
Plugins.xml
<SolutionProfile xmlns="http://schemas.microsoft.com/pag/cab-profile">
<Modules>
<ModuleInfo AssemblyFile="PluginXXX.dll" />
</Modules>
</SolutionProfile>
ProfileCatalog.xml
<SolutionProfile xmlns="http://schemas.microsoft.com/pag/cab-profile/...
Hi All,
I have an XML file
<searchResponse requestID=“500” status=“success”>
<pso>
<psoID ID=“770e8400-e29b-41d4-a716-446655448549”
targetID=“mezeoAccount”/>
<data>
<email>[email protected]</email>
<quotaMeg>100</quotaMeg>
<quotaUsed>23</quotaUsed>
<realm>Meze...
I want to write a link query for my xml. Actually i dont know it.
i have write some code here.
Dim query = _
From p In MyPermissionXml.Elements("menuNode").Descendants("menuNode") _
Where p.Attributes("title").ToString = "Company"
from where clause , i think it's wrong. how to represent an attribute here?
...
Hi
I’d like to start learning Linq to Xml, but before I do that, are there any technologies I should know prior to learning Linq to Xml?
Thus, besides the basics of XML and XML schema, which of the following technologies I must, which I would be advisable to and which I don’t need to learn before trying to learn Linq to XML:
• Net Sch...
I am trying to union to queries to create an XML file. The query itself works as T-SQL, but my implementation as LINQ-TO-XML fails with "Could not translate expression..." error.
Am I asking the wrong question? Is this approach flat wrong? I am new to LINQ. How do I create a single XML from 2 queries?
Dim db As New SOMEDataContext
Dim...
Hi All,
I'm getting a string returned from a website that looks like this
<?xml version=\"1.0\" encoding=\"UTF-8\"?><searchResponse requestID=\"500\" status=\"success\"><pso><psoID ID=\"61F2C644-F93A-11DE-8015-73A11AB14291\" targetID=\"mezeoAccount\"><data><email>[email protected]</email><quotaMeg>2048</quotaMeg><quotaUsed>18797...
Hi,
I'm trying to perform an outer join on two xml documents using the following code:
// load two xml files
XElement input = XElement.Load(@"c:\temp\input.xml");
XElement output = XElement.Load(@"c:\temp\output.xml");
var root = new XElement("Response",
from p in input.Descendants("Row")
...
Hi,
I have developed a web application that has a SqlServerMembershipProvider with it and a db interface using linqtosql. But we had some problems with the membership provider when we deployed the application to our web host. It was because of some application pool configurations which we could fix in our local IIS server but we couldn'...
I have hierarchical data stored in an XML file. There are multiple companies, each can have multiple lines of business. They conduct each line of business in multiple states. And in each state there can be multiple rates structures. A bogus sample is shown below.
How do I write a LINQ to XML query to return, for example, all the rates s...