OAI-PMH repo showing "invalid character"


#1

Was working fine, now it isn’t. Not sure where to start with this.

When you force it to output HTML anyway:
XML parsing failed
XML parsing failed: syntax error (Line: 1, Character 0)
Error: invalid character

Stack Trace:

  1. {main}() /home/omeka/index.php:0
  2. Omeka_Application->run() /home/omeka/index.php:23
  3. Zend_Application->run() /home/omeka/application/libraries/Omeka/Application.php:79
  4. Zend_Application_Bootstrap_Bootstrap->run() /home/omeka/application/libraries/Zend/Application.php:384
  5. Zend_Controller_Front->dispatch() /home/omeka/application/libraries/Zend/Application/Bootstrap/Bootstrap.php:105
  6. Zend_Controller_Dispatcher_Standard->dispatch() /home/omeka/application/libraries/Zend/Controller/Front.php:954
  7. Zend_Controller_Action->dispatch() /home/omeka/application/libraries/Zend/Controller/Dispatcher/Standard.php:308
  8. Zend_Controller_Action_HelperBroker->notifyPostDispatch() /home/omeka/application/libraries/Zend/Controller/Action.php:527
  9. Zend_Controller_Action_Helper_ViewRenderer->postDispatch() /home/omeka/application/libraries/Zend/Controller/Action/HelperBroker.php:277
  10. Zend_Controller_Action_Helper_ViewRenderer->render() /home/omeka/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php:972
  11. Zend_Controller_Action_Helper_ViewRenderer->renderScript() /home/omeka/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php:933
  12. Zend_View_Abstract->render() /home/omeka/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php:912
  13. Omeka_View->_run() /home/omeka/application/libraries/Zend/View/Abstract.php:888
  14. include() /home/omeka/application/libraries/Omeka/View.php:117
  15. Output_OmekaJson::toJson() /home/omeka/application/views/scripts/items/browse.omeka-json.php:2
  16. XSLTProcessor->transformToXml() /home/omeka/application/models/Output/OmekaJson.php:38

#2

The stack trace you posted doesn’t appear to be related to the OAI-PMH repository plugin.

This kind of thing can happen if you have a plugin or theme introducing extra whitespace on every page (you’d see a blank like at the top of View Source for any page, that kind of thing). It’s easy to accidentally do this by having whitespace outside <?php ?> tags in any file.


#3

Cool. This is all that was given to me in the logs, though.
At what point do the plugins get “called” by the Omeka application?

The only issue I get is from the one URL that is related to the OAI-PMH repo URL.

The plugin files haven’t been modified whatsoever, so I’m wondering where I should look for any excess white spaces.


#4

I switched the theme over from the custom theme, and deactivated all plugins. It’s still giving me the same error.
Where do I try next?


#5

Do you have a link to the repository?


#6

I’ll get you one. I have a lot of instances of Omeka that I inherited with a lot of undocumented custom code. Some repos are private, but I’ll clone it and upload it then post a link.


#7

#8

Sorry, I meant a link to the OAI-PMH repository, the site itself in other words.


#9

https://omeka.library.appstate.edu/oai-pmh-repository/request


#10

There’s a few issues here…

  • First, there’s some problem with your SSL certificate which makes it difficult to view this site from some browsers (I encountered errors from Firefox and curl)
  • Second, I then get a “content decoding” error when trying to view the repository XML output. This is about gzip/compress encoding and seems to affect other XML outputs as well… I get the same error from https://omeka.library.appstate.edu/items/browse?output=omeka-xml which is the omeka-xml output format and unrelated to the OAI plugin. Perhaps you have an Apache or other server setting, or a proxy if there’s one involved, that’s doing or trying to do something related to compression of XML?
  • Third, there is an extra newline in your code, it’s visible if you “view source” on any of the normal pages: there’s a blank line on top. I’m thinking the likely location is your theme. Something like the custom.php file which is loaded on every request would be a probable place to find the issue. Generally, for files containing just PHP code, you want to start the file with an opening <?php tag and then never have a closing tag anywhere (the end of the file will “close” for you).

#11

I disabled all plugins and set the Theme to Thanks Roy and still got the same issue with just the raw XML output from https://omeka.library.appstate.edu/items/browse?output=omeka-xml .
Which files should I start looking for the malformatted PHP?