Get a string representation for all namespace declarations as xmlns="" and xmlns:p="". @return: A separated list of declarations. @rtype: basestring
(self)
| 793 | return result |
| 794 | |
| 795 | def nsdeclarations(self): |
| 796 | """ |
| 797 | Get a string representation for all namespace declarations |
| 798 | as xmlns="" and xmlns:p="". |
| 799 | @return: A separated list of declarations. |
| 800 | @rtype: basestring |
| 801 | """ |
| 802 | s = [] |
| 803 | myns = (None, self.expns) |
| 804 | if self.parent is None: |
| 805 | pns = Namespace.default |
| 806 | else: |
| 807 | pns = (None, self.parent.expns) |
| 808 | if myns[1] != pns[1]: |
| 809 | if self.expns is not None: |
| 810 | d = ' xmlns="%s"' % self.expns |
| 811 | s.append(d) |
| 812 | for p, u in self.nsprefixes.items(): |
| 813 | if self.parent is not None: |
| 814 | ns = self.parent.resolvePrefix(p) |
| 815 | if ns[1] == u: |
| 816 | continue |
| 817 | d = ' xmlns:%s="%s"' % (p, u) |
| 818 | s.append(d) |
| 819 | return ''.join(s) |
| 820 | |
| 821 | def match(self, name=None, ns=None): |
| 822 | """ |
no test coverage detected