My Horrible XML Parser
Exercise for UNIX classes at ISEN school.
cat plant_catalog.xml | ./mhxmlp.sh
tester.sh
allows testing a few conditions with different files :
plant_catalog.xml
: 0: No errorempty.xml
: 11: Error, the file is emptyno_catalog.xml
: 19: Error, malformed XML, catalog not foundno_plant.xml
: 19: Error, malformed XML, unexpected data not in plant line 123no_opening.xml
: 19: Error, no opening tag on line 284no_closing.xml
: 19: Error, no closing tag on line 166double_plant.xml
: 19: Error, you can't define a plant inside a plant (no plantception) line 90duplicated.xml
: 19: Error, malformed XML, duplicated entry line 62no_preamble.xml
: 19: Error, no xml preambleno_common.xml
: 19: Error, malformed XML, COMMON field not found./mhxmlp.sh [arg]
: 5: Error, wrong arguments