Questions tagged [xelement]

XElement is part of System.Xml.Linq in .NET Framework. This class represents an XML element, the fundamental XML construct.

An XElement has an XName, optionally one or more attributes, and can optionally contain content.

An XElement can contain the following types of content:

  • XElement
  • XComment
  • XProcessingInstruction
  • XText

Reference: XElement Class on MSDN

883 questions
0
votes
1 answer

XElement Parse error when trying to parse string

I am getting xml parse error while trying to parse a string (with CDATA within CDATA) var cont = "

"; XElement.Parse(cont); Error: The 'op' start tag on line 1 position 2 does not match the…
Dot Net Dev
  • 574
  • 8
  • 20
0
votes
1 answer

C# - Cannot access the file "X" because it is used by another process

if (!File.Exists(signatureFile)) { XElement signature; try { XNamespace ns = "http://www.w3.org/2000/09/xmldsig#"; signature = new XElement("DocumentSignature", new…
0
votes
1 answer

How to convert list of XElement to XDocument?

My work is to remove some nodes from an XML based upon certain conditions and then parse the changed XML to a string. To do that: I converted string(workingData)to Xdocument and then added a condition to select xelements (abc) which works fine. Now…
rohit singh
  • 1,239
  • 3
  • 15
  • 26
0
votes
1 answer

Fail getting specific XElement

I have a problem. I need to loop through a xml and get a specific data. I need to get for each all and write them into a List. I did like this: foreach (var typemapping in maplist.Elements("API- …
Felix J.
  • 33
  • 4
0
votes
1 answer

How to save attributes using XElement?

new XElement ( "EffectFile", new XElement ( "Effects", this.Effects.Select ( e => new XElement ( "Options", e.Options.Select ( o => new XElement ( "Option", o ) ) ) ) ) ) I am trying to add an attribute to the Option in the…
Joan Venge
  • 315,713
  • 212
  • 479
  • 689
0
votes
1 answer

How to select a specific element using C#, Linq and XML?

I would like to read the five yellow marked (Screenshot) elements from an xml file. ... Unfortunately, I don't get a result. But I also get no error. What am I doing wrong? This is the XML File:
Daniel M.
  • 3
  • 3
0
votes
0 answers

XElement write numeric character reference

I'm trying to write a strings.xml file for our android app via a resource provider from our translation tool. So the procedure is like this: -Start translation tool and import strings.xml -Do the translations -Use the custom resource provider to…
user2738829
  • 41
  • 1
  • 2
  • 6
0
votes
1 answer

How can I access to a XML attribute with prefix?

I have a XML file which contain this code: more information +... more information I need to access to value of z:id, I think should be something like this: xmlDocument =…
JoseJimRin
  • 372
  • 1
  • 4
  • 20
0
votes
1 answer

How to send security header to WCF Service

Hi I have been working on an integration with a WCF service.. I have use a WSDL link to generate the call to the WCF. I'm always receive a message Username/Password are required in SOAP Header but I don't know what I'm doing wrong. When I made the…
0
votes
2 answers

Create XMLs from xmls using C#

I have a XML file. I am looking for help to create multiple xml files from this xml file . The new xml will have the all the node with the same EmpID.I am using C# code and able to create xmls Xml looks like this -
user2897967
  • 337
  • 2
  • 8
  • 24
0
votes
1 answer

c#, update child node in XML

I have an xml file like below
Arash
  • 1,692
  • 5
  • 21
  • 36
0
votes
1 answer

Appending at specific place in XML with c#

I've a XML file like this
0
votes
1 answer
0
votes
1 answer

How to loop though XElements and compare values using C#

I have an XElement which contains similar nodes but different values. Like my XElement look like this 1 12## 125
user2897967
  • 337
  • 2
  • 8
  • 24
0
votes
1 answer

Add XDocument.Root to another XElement non working as expected

so I'm doing some xml manipulation and I've found myself in a strange situation. After adding an XElement with null Parent to another XElement I still had the Parent set to null. So after some testing I've fond the problem, but I don't clearly…