Handling xml files with different structures and different names

Posted by zachary on Stack Overflow See other posts from Stack Overflow or by zachary
Published on 2010-05-01T21:22:22Z Indexed on 2010/05/01 21:27 UTC
Read the original article Hit count: 378

Filed under:
|
|
|

I have a method and I want different users to pass me xml files. These files will have different names for the elements I am looking for and the elements I am looking for maybe at different structures. My first impression was that we should just tell them to pass in the xml in a standard format. However this is how they have their data and they insist that it is much easier if they don't have to convert it.

What can I do to take in data of all types?

Have them pass in a dictionary? number = mydata/numbers

What is the easiest way for them to define their data to me without actually changing it?

sample1

<numbers>
15
</numbers>

sample2

<mydata>
<mynumbers>
15
</mynumbers>
</mydata>

© Stack Overflow or respective owner

Related posts about Xml

Related posts about .NET