Remove xhtml namespace: >>> doc = PyQuery( ... ' ') >>> doc [<{http://www.w3.org/1999/xhtml}html>] >>> doc.xhtml_to_html() [ ]
(self)
| 308 | yield self._copy(elem, parent=self) |
| 309 | |
| 310 | def xhtml_to_html(self): |
| 311 | """Remove xhtml namespace: |
| 312 | |
| 313 | >>> doc = PyQuery( |
| 314 | ... '<html xmlns="http://www.w3.org/1999/xhtml"></html>') |
| 315 | >>> doc |
| 316 | [<{http://www.w3.org/1999/xhtml}html>] |
| 317 | >>> doc.xhtml_to_html() |
| 318 | [<html>] |
| 319 | """ |
| 320 | try: |
| 321 | root = self[0].getroottree() |
| 322 | except IndexError: |
| 323 | pass |
| 324 | else: |
| 325 | lxml.html.xhtml_to_html(root) |
| 326 | return self |
| 327 | |
| 328 | def remove_namespaces(self): |
| 329 | """Remove all namespaces: |
no outgoing calls