You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2006/06/27 21:11:33 UTC

[2.2] validation of Spring xml files fails

Hi,

Trying to add Spring component definitions to the "new" bricks sample
(see whiteboard/example-apps/bricks-archetype/STATUS.txt), I'm getting
a validation error at startup, when Spring tries to parse my XML
component definition file.

The same happens when running core/cocoon-webapp and requesting
http://localhost:8888/samples/spring/ :

org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration
of element 'beans'.
...
at org.apache.xerces.parsers.DOMParser.parse
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse
...
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument
...
at org.apache.cocoon.core.container.spring.BeanFactoryFactoryImpl.createBeanFactory
...

any clues are welcome...

-Bertrand

Re: [2.2] validation of Spring xml files fails

Posted by Carsten Ziegeler <cz...@apache.org>.
Bertrand Delacretaz wrote:
> On 6/27/06, Bertrand Delacretaz <bd...@apache.org> wrote:
> 
>> ...org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration
>> of element 'beans'...
> 
> Weird...this was cause by having the ASF license comment before the
> DOCTYPE in the XML document, although this is valid AFAIK.
> 
Yes, it's valid. Starting with Spring 2.0 you can either use the spring
dtd or a new schema. Now spring 2.0 rc1 is using a not so clever
detection mechanism wheter a file is using the dtd or not: it scans the
first five lines of the file for the doctype definition. If it does not
find one, it assumes the file is using the schema...apparently our
license header has more than five lines, so this mechanism of spring is
failing if you put the header before the doctype definition :(

I already filed a bug and they hopefully come up with a better solution
for rc2/final. In the meantime, we have to put the doctype before the
licence header.

Carsten
-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Re: [2.2] validation of Spring xml files fails

Posted by Bertrand Delacretaz <bd...@apache.org>.
On 6/27/06, Bertrand Delacretaz <bd...@apache.org> wrote:

> ...org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration
> of element 'beans'...

Weird...this was cause by having the ASF license comment before the
DOCTYPE in the XML document, although this is valid AFAIK.

<?xml version="1.0" encoding="UTF-8"?>
<!-- comment here causes the problem! -->
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

-Bertrand