[Tutor] memory error

Danny Yoo dyoo at hashcollision.org
Wed Jul 1 07:17:27 CEST 2015


Hi Joshua,



The issue you're encountering sounds like XML namespace issues.


>> So I tried that code snippet you pointed me too and I'm not getting any output.


This is probably because the tag names of the XML are being prefixed
with namespaces.  This would make the original test for node.tag to be
too stingy: it wouldn't exactly match the string we want, because
there's a namespace prefix in front that's making the string mismatch.


Try relaxing the condition from:

    if node.tag == "page": ...

to something like:

    if node.tag.endswith("page"): ...


This isn't quite technically correct, but we want to confirm whether
namespaces are the issue that's preventing you from seeing those
pages.


If namespaces are the issue, then read:

    http://effbot.org/zone/element-namespaces.htm


More information about the Tutor mailing list