You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Lyteck Lynhiavu <ly...@lynhiavu.com> on 2004/03/23 23:48:32 UTC

The XML declaration may only appear at the very beginning of the document

I am trying to publish xml to pdf. the process is established and works most
of the time.

Would someone know why I sometimes get the cocoon error "The XML declaration
may only appear at the very beginning of the document." on perfecly valid
XML?

Description:org.apache.cocoon.ProcessingException: Could not read resource
file:/D:/Publisher/jakarta-tomcat-4.0.1/webapps/cocoon/test/test.xml:
org.xml.sax.SAXParseException: The XML declaration may only appear at the
very beginning of the document.

The XML declaration is indeed at the top and a sample fragment is below:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "company x//DTD company x Technical Publication//EN"
"c:\documentum\xml applications\companyx.dtd"
[<!ENTITY fr PUBLIC "-//company x//Contact fr//EN" "fr.xml">
<!ENTITY uk PUBLIC "-//company x//Contact uk//EN" "uk.xml">
]>
<!--ArborText, Inc., 1988-2001, v.4002-->

I hope this is a common enough error with a resolution?

The cocoon server is Windows to which I am supplying zipped xml/jpgs
remotely via the browser. I don't have much information beyond that.

Thanks very much, Lyteck


Re: The XML declaration may only appear at the very beginning of the document

Posted by Jorg Heymans <jh...@domek.be>.
maybe you have some non-visible characters before your <?xml 
version="1.0" encoding="utf-8"?> or some process is inserting them?

Lyteck Lynhiavu wrote:

> I am trying to publish xml to pdf. the process is established and works 
> most of the time.
> 
> Would someone know why I sometimes get the cocoon error "The XML 
> declaration may only appear at the very beginning of the document." on 
> perfecly valid XML?
> 
>     Description:org.apache.cocoon.ProcessingException: Could not read
>     resource
>     file:/D:/Publisher/jakarta-tomcat-4.0.1/webapps/cocoon/test/test.xml:
>     org.xml.sax.SAXParseException: The XML declaration may only appear
>     at the very beginning of the document.
> 
> The XML declaration is indeed at the top and a sample fragment is below:
> 
>     <?xml version="1.0" encoding="utf-8"?>
>     <!DOCTYPE book PUBLIC "company x//DTD company x Technical
>     Publication//EN" "c:\documentum\xml applications\companyx.dtd"
>     [<!ENTITY fr PUBLIC "-//company x//Contact fr//EN" "fr.xml">
>     <!ENTITY uk PUBLIC "-//company x//Contact uk//EN" "uk.xml">
>     ]>
>     <!--ArborText, Inc., 1988-2001, v.4002-->
> 
> I hope this is a common enough error with a resolution?
> 
> The cocoon server is Windows to which I am supplying zipped xml/jpgs 
> remotely via the browser. I don't have much information beyond that.
> 
> Thanks very much, Lyteck
> 


Re: The XML declaration may only appear at the very beginning of the document

Posted by Joerg Heinicke <jo...@gmx.de>.
On 23.03.2004 23:48, Lyteck Lynhiavu wrote:

> I am trying to publish xml to pdf. the process is established and works most
> of the time.
> 
> Would someone know why I sometimes get the cocoon error "The XML declaration
> may only appear at the very beginning of the document." on perfecly valid
> XML?

Unfortunately that's very unspecific, so I also can you only tell 
unspecificly that for what ever reason sometimes you have some trash in 
front of the XML declaration. I guess you first have to make it 
reproducable and after this do some debugging what exactly comes in.

> I hope this is a common enough error with a resolution?

No, I heard the first time of it. Of course the error message itself is 
known, but that is normally caused by the developer. I don't know of an 
error that occurs only sporadically.

> The cocoon server is Windows to which I am supplying zipped xml/jpgs
> remotely via the browser. I don't have much information beyond that.

You upload the files and process them in the pipeline? How does the 
sitemap look like?

Joerg