Java, Saxparser: How to find out if XML element is self-closing?
===

I have googled, searched and read, but have been unable to find an answer.

I have XML-files that look somewhat like this:

    <Patient PID="5" Disease="Flu" FavoriteBird="Norwegian Blue"/>
    <Patient PID="33" Disease="Thripshaw's Disease" FavoriteBird="Dodo">
        <Contact Hospitalized="2013 05 30"/>
    </Patient>

I want to anonymise each patients' favorite bird. That is, produce output that looks like this:

    <Patient PID="5" Disease="Flu"/>
    <Patient PID="33" Disease="Thripshaw's Disease">
        <Contact Hospitalized="2013 05 30"/>
    </Patient>

It is all going swimmingly, except for the fact that I can only handle the last type of patient tag- that is, when the element is not self-closing.

My "endElement"-method simply looks like

    out.write(qName + "/n>")

and is never invoked for the first type of Patient tag. 

What do I do? If there was a way to find out whether a tag is self-closing or not I could easily fix it.