Closed rockkoca closed 6 years ago
h = pq('''<html xmlns="http://www.w3.org/1999/xhtml" ><div ><a href="/" target="_blank" >Main</a></div></html>''') logger.critical(h('a')) cannot get the a tag
h = pq('''<html xmlns="http://www.w3.org/1999/xhtml" ><div ><a href="/" target="_blank" >Main</a></div></html>''')
logger.critical(h('a'))
cannot get the a tag
After I replace xmlns="http://www.w3.org/1999/xhtml" to mlns="http://www.w3.org/1999/xhtml" or remove it entirely, above code works.
http://pyquery.readthedocs.io/en/latest/api.html#pyquery.pyquery.PyQuery.remove_namespaces
h = pq('''<html xmlns="http://www.w3.org/1999/xhtml" ><div ><a href="/" target="_blank" >Main</a></div></html>''')
logger.critical(h('a'))
cannot get the a tag
After I replace xmlns="http://www.w3.org/1999/xhtml" to mlns="http://www.w3.org/1999/xhtml" or remove it entirely, above code works.