O
O
one__for__one2018-09-27 17:25:51
Parsing
one__for__one, 2018-09-27 17:25:51

How to determine if all nodes of an XML document are parsed?

Hello.
There is an xml file with an unstable set of nodes: the name of the tag is the same, each tag has its own "genre" attribute, which differs from another node in value. The value in the tag is parsed:

<track genre="Rap" time="3:24">
  </track>
  <track genre="Hip-Hop" time="5:06">
  </track>

In the C# code, it is hard-coded from which tag for which attribute to "take" (during object initialization) data.
The problem is that the XML file can change the structure and a new tag will be added, for example, the tag in which "genre" is equal to "Rock" and then I will not process this node and the data will be lost.
What is the best way to check if all data is parsed? Create a list of all attributes that the code can save and check whether all nodes have been parsed, if not, then display an exception, who faced such a problem, how did you solve it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question