(self)
return attrs
Return string of namespace attributes from this element and
        ancestors.
Return string of namespace attributes from this element and
        ancestors.
Return string of namespace attributes from this element and ancestors .
def _getNSattrs(self):
        """Return string of namespace attributes from this element and
        ancestors."""
        # XXX This needs to be re-written to walk the ancestors of the
        # context to build up the namespace information from
        # declarations, elements, and attributes found in context.
        # Otherwise we have to store a bunch more data on the DOM
        # (though that *might* be more reliable -- not clear).
        attrs = ""
        context = self.context
        L = []
        while context:
            if hasattr(context, '_ns_prefix_uri'):
                for prefix, uri in context._ns_prefix_uri.items():
                    # add every new NS decl from context to L and attrs string
                    if prefix in L:
                        continue
                    L.append(prefix)
                    if prefix:
                        declname = "xmlns:" + prefix
                    else:
                        declname = "xmlns"
                    if attrs:
                        attrs = "%s\n    %s='%s'" % (attrs, declname, uri)
                    else:
                        attrs = " %s='%s'" % (declname, uri)
            context = context.parentNode
        return attrs
def _getNSattrs ( self ) : # XXX This needs to be re-written to walk the ancestors of the # context to build up the namespace information from # declarations, elements, and attributes found in context. # Otherwise we have to store a bunch more data on the DOM # (though that *might* be more reliable -- not clear). attrs = "" context = self . context L = [ ] while context : if hasattr ( context , '_ns_prefix_uri' ) : for prefix , uri in context . _ns_prefix_uri . items ( ) : # add every new NS decl from context to L and attrs string if prefix in L : continue L . append ( prefix ) if prefix : declname = "xmlns:" + prefix else : declname = "xmlns" if attrs : attrs = "%s\n    %s='%s'" % ( attrs , declname , uri ) else : attrs = " %s='%s'" % ( declname , uri ) context = context . parentNode return attrs