zotero/translators — pull request #542 by aurimasv (2013-02-23 07:22:39+00:00)
Title: [Embedded Metadata] Add compatibility for XHTML

Re {@adam3smith's message on zotero-dev@googlegroups.com, which disappeared somewhere}
>sample page: http://www.hindawi.com/journals/mpe/2013/868174/abs/
The site has full google highwire metadata embedded, yet the embedded metadata translator doesn't get most of it.
If I look at something very simple, and clearly in the page like
Z.debug(ZU.xpathText(doc, '//meta[@name="citation_doi"]/@content'))
Zotero returns null. Same for doc.evaluate.
The page is fully loaded and what does work is
doc.getElementsByTagName('meta')
(etc.)
Is this because the site is xhtml? Anything simple I can do about this - ideally I don't want to rewrite large chunks of the highwire code in the embedded metadata translator.

You're right about xpaths and XHTML. This patch should make EM compatible with HTML and XHTML pages.

@simonster, I ran into an odd issue. Initially I added 'x' namespace to `namespaces` inside `init`, which is called from `detectWeb`. The problem was that by the time `doWeb` is called `namespaces` was just an empty object again. I thought that maybe the environment was being lost between `detectWeb` and `doWeb`, but that doesn't seem to be the case, since `RDF` persists. So I'm quite confused with what's happening there.