0

I have an XML file that I must read. I am using XmlReader combined with XElement. The problem is when I try to use this syntax:

var test = field.Element(nameSpace + "value").Value;

I get this exception:

The character ':', hexadecimal value 0x3A, can not be used in a name

The namespace is like "http://anURL" so it is correct while the field XElement is:

<field name="Name" type="String" xmlns="http://anUrl">
    <value type="String"><![CDATA[aName]]></value>
</field>

How exactly do I use XElement.Element() when I have a namespace involved?

I was referring to answer like this one

Micha Wiedenmann
  • 18,825
  • 20
  • 87
  • 132
Daniele Sartori
  • 1,600
  • 20
  • 36

0 Answers0