0

I have a XML file and its content looks like below

<?xml version="1.0" encoding="UTF-8"?>
<Module path="/Automated Meter Reader - sample 1/01 Requirements/System Requirements" Baseline="current" Module_ID="00000080">
<ObjectIdentifier value="AMR-SR-1">
<Attribute name="ParentID" value="Level 1"/>
<Attribute name="custom 1" value="custom value <special value> custom value"/>
</ObjectIdentifier>
</Module>

In above XML data the line

<Attribute name="custom 1" value="custom value <special value> custom value"/>

has escape characters i.e. < and >
I want to handle all the escape characters which are inside attribute value. Attribute values are specified inside double quote mark. XML structure is fixed, attribute value differs according to document of which XML is generated.
I have been searching to get attribute values of XML, but it looks like we need to have valid XML if I want to use XML functions of C#

e.g. string attributeValue = chldNode.Attributes["Name"].Value;

Please guide me on how can I handle escape characters for above use case.
Links I have referred
How to read attribute value from XmlNode in C#?
String escape into XML
Getting attribute value of an XML Document using C#
Read XML Attribute using XmlDocument

Community
  • 1
  • 1

0 Answers0