http://bugzilla.gnome.org/show_bug.cgi?id=502960See the bug for details, but this seems to be a bona fide libxml bug: when an entity reference is parsed using SAX, any associated namespaces from enclosing nodes are not inherited. Please have a look and let me know if you agree.