How can I check that the root element of an XML file has a specific name?
I can correctly assert whether the root has a specific attribute like this:
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<pattern id="1">
<rule context="root_element">
<assert test="@OBJID">Missing OBJID.</assert>
</rule>
</pattern>
In this case, I'd like to test that the root element is root_element
.
For example, this should fail (but it doesn't):
<?xml version='1.0' encoding='UTF-8'?>
<mets OBJID="123">
<Age>30</Age>
</mets>
For completeness, I am testing using unittest
in python 3.
Any link to some documentation about this is appreciated.