BenjaminR
BenjaminR

Reputation: 23

How to set json:Type="Decimal" Attribute in XMLNode C#

I want to set the attribute json:Type="Decimal" into a XML Node.

I have the XML Document

<root>
 <a>12.55</a>
 <b>Test</b>
</root>

Now I want to set the attribute

json:Type="Decimal"

in the XML Node

<a>12.55</a>

that it looks like

<a json:Type="Decimal">12.55</a>

I tried with the following Code

XmlAttribute att = Doc.CreateAttribute("Type");
att.Prefix = "json";
att.Value = "Decimal";
node.Attributes.Append(att);

but the result is

<a Type="Decimal">12.55</a>

Who can help me!

The original question is from here

Upvotes: 0

Views: 47

Answers (0)

Related Questions