Logo Search packages:      
Sourcecode: zope-parsedxml version File versions

def ParsedXML::DOM::ExpatBuilder::FragmentBuilderNS::_getNSattrs (   self  )  [private]

Return string of namespace attributes from this element and
ancestors.

Definition at line 820 of file ExpatBuilder.py.

00820                          :
        """Return string of namespace attributes from this element and
        ancestors."""
        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


class ParseEscape(Exception):


Generated by  Doxygen 1.6.0   Back to index