reading xml elements based on dynamic element names using VS2008 c# and linq to xml
Posted on 2012-03-29
Let's say that I have an xml file that looks like this:
Let's also say that I have no control over the xml file (it's incoming) and the producer of the file could change it at any time to be:
In my VS2008 c# program, is it even possible to set up a configuration that says something like "find the item number at <ord><line><sku>" then read the xml file (using linq to xml) "dynamically"?
I guess, another way of putting it would be can I assign string variables, such as El1, El2, El3 and set them equal to "ord", "line", and "sku", respectively, then read for those elements using the variable names instead of the element names?
Thanks in advance for your thoughts on this.