vendredi 27 octobre 2017

How to validate my xml parsing code? (Python, against schema or example document)

So for a project I need to parse a very specific xml format. Parsing just the most basic stuff is easy, but then there are always many cases not covered. F.e. if I take one example doc maybe it has only one tag of a specific element, but the next one will have multiple tags, and so on and so forth.

Because of this, I would like to take a more systematic approach, where I can validate my parsing code against either the schema or an example doc (and write tests for it). The problem with the example doc is that I do not have one, all docs I parse seem to have slight (valid) differences so that I cannot validate against one of these.

Searching and other questions only talk about validating the xml documents, but those are expected to be valid already. The format in question is this http://ift.tt/29cazOn (though I guess it shouldn't matter)

Aucun commentaire:

Enregistrer un commentaire