This is the first time I’ve used System.Xml.Linq to serialize. I have learned many things especially on this site, but now I can’t solve a problem, perhaps trivial, but I can’t.
I need to create this Xml tag:
<value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ST">**Positive**</value>
But I can’t insert the text value Positive.
This is my code:
XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
XElement oXElement = new XElement(ns + "value",
new XAttribute(XNamespace.Xmlns + "xsi" , "http://www.w3.org/2001/XMLSchema-instance"),
new XAttribute(xsi + "type", "ST")
);
I get everything except the Positive text, because if I try to write “ST” + “Positive” obviously the string is used and it’s not good.
If I try to create a new attribute I don’t know what name to give it and it doesn’t accept empty names.
I searched for a long time before writing here but I didn’t find the solution, probably because I’m a beginner.
Can you help me?
Thank you very much.