“xml processing instruction not at start of external entity”

I’ll spare my readers the head-bashing that finding this involved and spell it out:

My perfectly valid XUL file was failing to load once I added the XML directory to use a stylesheet. The error message suggested some error parsing the XML (”xml processing instruction not at start of external entity”).

In fact, the problem had nothing to do with the XML’s validity. That’s Firefox’s helpful way of telling me “I can’t find this CSS file, go fish.”

I had botched the install.rdf entries for the skin directory and Firefox was unable to find the .css file.

It is important to use the element “em:skin” when telling Firefox about skin-related files (e.g. CSS and images) in your extension’s .jar file. Not “em:package”.

Curiously enough, none of the hits for “not at start of external entity” on Google even suggested that the problem might be in Firefox’s inability to find the CSS file. Perhaps some day this entry will fill that gap.

6 Responses to ““xml processing instruction not at start of external entity””

  1. Lars Says:

    “PC load letter?! What the f*ck does that mean??” - Michael Bolton, from Office Space

  2. Greg Yardley's Internet Blog Says:

    Thanks, Ken Fox!

    I love how the Internet and blogging helps you help others, just by writing about your own personal experiences. This entry is a thank you note to software developer Ken Fox, who helped me through something quite difficult with this blog entry. When …

  3. Lighthammer Says:

    Hey

    Had the same Error message … another thing to watch out for is the duplicate declaration in .XML file and .XSL file.
    Check for duplicate :)

    Obvious i know … but hey @ 2:00am … another story

    Sweet

  4. Ender Says:

    Ken, if you want to figure in the first places in Google, add the full message:
    “xml processing instruction not at start of external entity”. :-)

    I will see if that is my problem.

    Best regards,

    Ender.

  5. Bankim Says:

    hi, i could not understand the folowing statement

    It is important to use the element “em:skin” when telling Firefox about skin-related files (e.g. CSS and images) in your extension’s .jar file. Not “em:package

    I am getting this error with a well formed xml.I have no control on the xml as its dynamically generated.

  6. Ken Says:

    Hi Bankim,

    Oops — this comment was buried in a billion spam comments and so I missed it when it was posted. The problem I was running into (and referencing to in this post) was Firefox complaining about “xml processing instruction not at start of external entity” when in fact the problem was the CSS file not being specified correctly in the extension description.

    My XML was well-formed, too, but was incorrectly telling Firefox where the CSS file for the extension was, and instead of complaining about a missing CSS file, Firefox instead blew up with an XML error message.

    –Ken