Questions tagged [xattribute]

The xattribute tag is for questions about the C# (System.Xml.Linq) XAttribute class.

One MSDN reference page for the class is Xattribute Class (System.Xml.Linq).

50 questions
0
votes
3 answers

Linq2Xml XAttribute hierarchy location?

Im having trouble understanding this : why Microsoft put Xattribute under Xobject ? they say that : Attributes are not derived from XNode; they are not nodes in the XML tree. Instead, they are simply name/value pairs associated with an …
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
0
votes
0 answers

Why can’t I get ENODATA from Setxattr?

The following is always meeting the ENOENT condition at the end. I would like to print ENODATA. What do I need to change in setxattr? #include #include #include #include int main() { int ret; const…
dodobirdie
  • 13
  • 3
0
votes
2 answers

Is there a difference between el.Attribute ("...") and el.Attribute (XName.Get ("..."))?

In our production code, I've seen XML attributes being read using explicit XName.Get call: var name = element.Attribute (XName.Get ("name")); I used to always pass a string to Attribute: var name = element.Attribute ("name"); This is more readable…
Dan Abramov
  • 264,556
  • 84
  • 409
  • 511
0
votes
0 answers

C# XElement how do I add different attributes in a specific order?

I have the following C# code to generate an XML document. The problem is that I need to swap the order of the attributes in the tag "CState". Therefore I have already tried several things. Unfortunately it does not work or I get an…
ThoDan
  • 43
  • 4
0
votes
1 answer

Not finding elements in xml even when attribute property is present

Given the following XML
dinotom
  • 4,990
  • 16
  • 71
  • 139
0
votes
1 answer

Put attributes via XElement_Not as XMLAttribute

Here is my two classes: the class Characteristic and Definition : [DataContract] public class Characteristic { [DataMember] public Definition Definition { get; set; } } [Serializable] public class Definition { …
IngTun2018
  • 329
  • 1
  • 10
0
votes
1 answer

xmlns attribute cannot be added as an attribute to XML element

I come to you because I have a problem. In summary, when I try to add the value to the xmlns attribute of the Signature element, I get the following error. Spanish System.Xml.XmlException : 'No se puede volver a definir el prefijo '' de '' a…
0
votes
1 answer

C# : Get Specific Element Before another Element with Linq

Consider the following snippet from an XSD:
Rico Strydom
  • 537
  • 1
  • 6
  • 26
0
votes
1 answer

How to properly access/modify an attribute in XElement object

I have some code that reads in a nicely formatted XML file. It wraps each XElement it reads into my object (ScriptEventNode) where I have some fields to allow the caller to change some of the Element and Attribute values that matter to us. I also…
kingtermite
  • 55
  • 2
  • 9
0
votes
3 answers

how to convert xml to list of objects

Here is the code my goal is to iterate over all the nodes and not just one so in my case it gets the first Device Node and all his children at once so how can i get every single Device and PortA PortB nodes. then i will be able to set my class…
Jawad Halaby
  • 21
  • 3
  • 8
0
votes
1 answer

XNamespace as additional attribute, why

I want to achieve this:
Klik Kliković
  • 364
  • 1
  • 5
  • 13
0
votes
1 answer

c# linq to xml update all descendants of specific value

I am creating a configuration file editor, and am currently implementing features for updating existing data. I would like to be able to update all attributes within the file which have a specific attribute, such as updating a user name. My XML…
Tim B
  • 23
  • 6
0
votes
0 answers

To Deserlize SOAP XML to WCF service method from C# and How to get xatttibute and xelement value in soap xml

When i Deserlize soap xml, i am getting Status and Token attribute value Null.How can i solve this problem. How to assign xattribute and Xelement values in model.How to use xml serlize in wcf service. I have Soap XML below
prakash
  • 1
  • 3
0
votes
1 answer

Relization of XElement, XAttribute + IDataErrorInfo for binding in wpf app

I use mvvm pattern in wpf app. As datasource i've XDocument. In UI i bind controls to XElements and XAttribute's values from this XDocument. f.ex. It allows me to have data in…
vitm
  • 473
  • 1
  • 3
  • 12
0
votes
5 answers

c# LINQ get Attribute value from XElement

I have the below XML in a data definitions file:
Our Man in Bananas
  • 5,809
  • 21
  • 91
  • 148