草庐IT

system.linq.dynamic

全部标签

xml - LINQ to XML 和 Distinct 自定义类

我有一个非常有趣的LINQ问题。我有一个文档,我正在尝试过滤结果,但为了过滤,我匹配来自XML的一个元素的REGEX结果。我有以下内容,使用LINQtoXML来获取我正在寻找的个人数据。DimoDocumentAsXDocumentoDocument=XDocument.Load("test.xml")Dimresults=(FromxInoDocument.Descendants.Elements("ROW")_SelectNewWith{.ApplicationName=GetApplicationName(x.Element("Message")),_.EventId=x.Ele

xml - 在 VB.NET 中使用 LINQ to XML 更新 XML 元素

我正在尝试更新以下XML文档中的元素:代码如下:DimxmldocAsXDocument=XDocument.Load(theXMLSource1)DimqlAsXElement=(FromlsInxmldoc.Elements("LabService")_WhereCType(ls.Element("ServiceType"),String).Equals("Scan")_Selectls.Element("Price")).FirstOrDefaultql.SetValue("23")xmldoc.Save(theXMLSource1)这是XML文件:Copy1PrintBlack

c# - Linq to XML 加入并添加数据?

给定这样的XML:123还有一个包含此数据的IEnumerable:[0]={Id=1,Data=429}[1]={Id=2,Data=271}[2]={Id=3,Data=328}是否有一种优雅的方式使用LINQtoXML将IEnumerable数据与基于通用Id的XML连接起来,而无需单独查询每个元素以链接数据?所以结果看起来像这样:142922713328我唯一能想到的就是这样,但我希望有一个更简洁的方法:foreach(vardinMyIEnumerable){XElementelement=(fromxinMyXDoc.Elements("Element")wherex.El

c# - 使用 linq 解析 youtube 提要

我想解析youtubechannel的原子提要。这是该rss原子提要的链接。http://gdata.youtube.com/feeds/api/users/cokestudio/uploads?orderby=updatedListlstYT=newList();XDocumentxDocumentYT=XDocument.Load(Server.MapPath("XMLFile.xml"));XNamespacexmlns="http://www.w3.org/2005/Atom";lstYT.AddRange((fromentryinxDocumentYT.Descendants

python - 错误 : "External ID not found in the system" in OpenERP

尝试安装模块时出现错误。我相信外部ID指的是view_id:raiseValueError('ExternalIDnotfoundinthesystem:%s'%(xmlid))ParseError:"ExternalIDnotfoundinthesystem:nk_test.bom_where_use_form"whileparsing/opt/odoo/odoo/addons/nk_test/mrp_where_bom.xml:4,nearWhereUseir.actions.act_windowproduct.templateformnew这是我的xml文件。定义了“bom_wh

c# - 更新 XML 文件 (C#/Linq)

我想知道如何更新我的XML文件。我知道如何读写,但不知道如何更新现有记录。我的XML文件如下所示:而且我希望能够更改文件中已有的XAttribute的值。我是这样写文件的:XElementxElement;xElement=newXElement("Orders");XElementelement=newXElement("Order",newXAttribute("Quantity",Quantity),newXAttribute("PartNo",PartNo),newXAttribute("Description",Description),newXAttribute("Disc

.net - 如何使用 XmlSerializer 序列化 System.Type 对象?

考虑这种类型:[DataContract]publicclassEntityId{[DataMember(Order=1)]publicstringIdAsString{get;set;}[DataMember(Order=2)]publicTypeType{get;set;}}我为它创建了一个Xml序列化程序程序集。但是,尝试序列化它会产生异常:System.InvalidOperationExceptionoccurredMessage=ThetypeNC.DTO.FlowFolderwasnotexpected.UsetheXmlIncludeorSoapIncludeattri

c# - Linq to XML - 提取单个元素

我有一个如下所示的XML/Soap文件:True我想提取SendDataResult值,但使用以下代码和我尝试过的各种其他方法很难做到这一点。即使元素中有值,它也始终返回null。XElementresponseXml=XElement.Load(responseOutputFile);stringdata=responseXml.Element("SendDataResult").Value;提取SendDataResult元素需要做什么。 最佳答案 您可以使用Descendants后接First或Single-目前您正在询问顶级

c# - LINQ to Dictionary - 使用 XML

我已经问过一个类似的问题,当然,这个问题是不同的,我试过了。我尝试使用Linq读取XML数据并解决了这个问题,但是,我需要选择多个值并将它们存储到字典中。我已经尝试过(评论是我的尝试)但我无法弄清楚并收到如下错误:System.NullReferenceException:Objectreferencenotsettoaninstanceofanobjectatdsdsdsds.MainClass+c__AnonStorey0.m__0(System.Xml.Linq.XElementdatanum)[0x00000]in/Users/p/Projects/dsdsdsds/dsdsd

c# - LINQ to XML 使用 idref 连接

我有一个如下所示的XML结构:[...]id_1001_023Apple[...]我想使用LinqtoXML将其读入(非匿名)对象。假设我有以下代码:varfruits=fromxeleinxDoc.Root.Element("Fruits").Elements("Fruit")selectnewFruit(){Weight=xele.Element("Weight").Value}我如何扩展查询以加入正确的FruitSpecification标签?目标是能够这样写:varfruits=fromxeleinxDoc.Root.Element("Fruits").Elements("Fr