Correct NS handling in groovy: you can test class of <ELEMENT>.name(). If there is no NS support, it's a String; if there is NS support, it's a QName, which you can then manipulate with that class's methods (e.g., in your example, you could check hierarchy.name().getLocalName() == 'citation')
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Correct NS handling in groovy: you can test class of <ELEMENT>.name(). If there is no NS support, it's a String; if there is NS support, it's a QName, which you can then manipulate with that class's methods (e.g., in your example, you could check hierarchy.name().getLocalName() == 'citation')