1
I have the following question...
I am reading an Xml, and to get the values of the nodes I use ...
public class Produto {
[XmlElement("PRODUTO")]
public string produto;
}
I would like a way to introduce the name of the element "PRODUCT" in a dynamic way, that is, could change the name of the element.
- Example:
string parametro = "produto";
XmlElement("parametro")]
public string produto;
Note: Remembering that the product string will receive the value that is recovered from the XML element.
I don’t know if you understand, but you better hope so.
I couldn’t understand, can you illustrate what you want to do? What’s the point? Do you want the property parameter to point to the product property? That’s it?
– George Wurthmann
I have an Nfe XML, and I need to get the data from that Nfe by reading the XML. Currently I recover the XML data using. Xmlelement and pass the tag name to recover the value. However not always the no and the TAG is the same, so I can not use this way pq when the name of the TAG is different from what is referenced in the code, will give error, so I wanted a way to dynamically define the name of the tag to pass as parameter pro Xmlelement, so that this way the tags were always correct.
– San Nunes
And in the case I used the product example, but in reality I need to recover the value of ICMS, but as there are 33 ICMS codes it gets complicated if it is not dynamic.
– San Nunes