MarcusBarnes / mik

The Move to Islandora Kit is an extensible PHP command-line tool for converting source content and metadata into packages suitable for importing into Islandora (or other digital repository and preservations systems).
GNU General Public License v3.0
34 stars 11 forks source link

OAI toolchain error: "Undefined namespace prefix" #502

Open bondjimbond opened 5 years ago

bondjimbond commented 5 years ago

See attached ini, mik.log and example metadata files...

I'm trying to pull down objects via the METS metadataPrefix, since it's the only one that contains useful information from the repository I'm targeting.

Problem: I'm getting the XML, but not the files. I've tried a few different XPaths, one of which should be valid according to this handy tool... but I wonder if there are problems with the fact that this XML contains so many namespaces?

Any suggestions for getting past this?

mru_oai.ini.txt

98.xml.txt

mik.log.txt

bondjimbond commented 5 years ago

And I can't even pull it out of the xlink:href attribute in the FLocat element...

So it turns out that XPath really doesn't like it if some of your elements (or attributes) have namespaces and others don't, or if you have a mix of namespaces.

Typical suggestion is to use the local-name() function within your xpath -- that is, something like this:

xpath_expression = "/record/metadata[1]/mets[1]/fileSec[1]/fileGrp[1]/file[1]/FLocat[1]/@*[local-name() = 'href']"

But that doesn't work here. (Seems to be a Java thing maybe?)

Is there any way to get such an option into MIK? Understanding XPaths with multiple namespaces in them would make life a lot easier in the OAI world.