jeya pandi

jeya pandi

  • NA
  • 62
  • 19.1k

How to create XML attribute name with special character:

Mar 27 2018 12:46 PM
Hi,
 
i am using a XMLDocument to generate a XML file and some elements have an attribute name containing the caracter ":".
 
The code is:
 
elem = xmldoc.CreateElement("Livraria");
elem.SetAttribute("Nome:XPTO", "TESTESARA");
elem.SetAttribute("Local", "Braga");
xmldoc.DocumentElement.AppendChild(elem);
 
In the XML file generated the attribute name is only XPTO and i wanted it to be Nome:XPTO.
 
Is this possible or is it a limitation of the framework?
 
Thanks in advance.

Answers (1)