You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Leo <le...@tstt.net.tt> on 2003/08/11 01:26:40 UTC

RE: Error: When accessing XSP page (Namespace forprefix 'xmldb' has not been declared)

Hello Forresters

I already had the namespace declared at the top of my xsp page
<xsp:page xmlns:xsp="http://apache.org/xsp"
          xmlns:xmldb="http://exist-db.org/xmldb/1.0">

I tried as was suggested ( put namespace in individual element e.g)
<xmldb:collection uri="xmldb:exist:///db/shakespeare/plays"
xmlns:xmldb="http://exist-db.org/xmldb/1.0"
		                	user="guest" password="guest">
but I am still getting the same error.
See extract from sitemap log
WARN    (2003-08-10) 19:17.34:332   [sitemap] (/functions/simple1.xsp)
PoolThread-3/ServerPagesGenerator: setup()
java.lang.RuntimeException: java.lang.RuntimeException: Namespace for prefix
'xmldb' has not been declared.
	at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3364)
	at
org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(TransformerH
andlerImpl.java:427)
	at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:91)
	at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:91)
	at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
	at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatc
h(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:318)
	at
org.apache.excalibur.xmlizer.DefaultXMLizer.toSAX(DefaultXMLizer.java:161)
	at
org.apache.cocoon.components.source.SourceUtil.toSAX(SourceUtil.java:166)
	at
org.apache.cocoon.components.source.SourceUtil.toSAX(SourceUtil.java:126)
	at
org.apache.cocoon.components.language.markup.LogicsheetCodeGenerator.generat
eCode(LogicsheetCodeGenerator.java:174)
	at
org.apache.cocoon.components.language.markup.AbstractMarkupLanguage.generate
Code(AbstractMarkupLanguage.java:376)
	at
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.generat
eSourcecode(ProgramGeneratorImpl.java:459)
	at
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(Pr
ogramGeneratorImpl.java:298)
	at
org.apache.cocoon.generation.ServerPagesGenerator.setup(ServerPagesGenerator
.java:202)


I have been able to test a simple example using builtin logicsheets and
it works fine.  (http://www.cocooncenter.de/articles/logicsheet.html)


So I am not understanding why it does not work in this instance??


Leo


-----Original Message-----
From: Jeff Turner [mailto:jefft@apache.org]
Sent: Wednesday, July 30, 2003 7:58 AM
To: forrest-dev@xml.apache.org
Subject: Re: Error: When accessing XSP page (Namespace forprefix 'xmldb'
has not been declared)


On Tue, Jul 29, 2003 at 08:29:43PM -0400, Leo wrote:
> Hi folks
>
> I have the configurations for XSP in forrest(in cocoon.xconf) set up and
> this
> works fine when there are no xmldb namespace references.
>
> I also have in cocoon.xconf builtin-logicsheet for xmldb
>         <builtin-logicsheet>
>             <parameter name="prefix" value="xmldb"/>
>             <parameter name="uri" value="http://exist-db.org/xmldb/1.0"/>
>             <parameter name="href"
value="resource://org/exist/xmldb.xsl"/>
>         </builtin-logicsheet>
>
> Trying to access an XSP page(simple1.xsp) with references to xmldb:
> <xsp:page xmlns:xsp="http://apache.org/xsp"
>           xmlns:xmldb="http://exist-db.org/xmldb/1.0">
> .
> .
> 		 <xsp:logic>
>      			String doc = request.getParameter("doc");
>                 	if(doc != null &amp;&amp; doc.length() &gt; 0) {
>                 		<p>Retrieving document <xsp:expr>doc</xsp:expr></p>
> 		                <xmldb:collection
> uri="xmldb:exist:///db/shakespeare/plays"
> 		                	user="guest" password="guest">
> 		                    <xml-source>
> 		                        <xmldb:get-document encoding="ISO-8859-1"
> as="xml">
> 		                             <xmldb:name>doc</xmldb:name>
> 		                        </xmldb:get-document>
> 		                    </xml-source>
> 		                </xmldb:collection>
> 		            }
> 	            </xsp:logic>


XSP pages must be valid XML documents.  Whenever you use a namespace
prefix, you need to first map it to a namespace URI.  In the XML above,
you're using the 'xmldb' prefix (in the xmldb:collection element) which
has no mapping.  You can declare the mapping with an extra attribute:

                   <xmldb:collection xmlns:xmldb="...."

Setting .... to whatever the correct namespace is.


--Jeff

> The problem
> 20:01:06.974 EVENT  ERROR   (2003-07-29) 20:01.06:964   [access  ]
> (/functions/s
> imple1.xsp) PoolThread-3/CocoonServlet: Internal Cocoon Problem
> org.apache.cocoon.ProcessingException: java.lang.RuntimeException:
Namespace
> for
>  prefix 'xmldb' has not been declared.: java.lang.RuntimeException:
...


>
> Regards
> Leo
>


Re: Error: When accessing XSP page (Namespace forprefix 'xmldb' has not been declared)

Posted by Jeff Turner <je...@apache.org>.
On Sun, Aug 10, 2003 at 07:26:40PM -0400, Leo wrote:
> Hello Forresters
> 
> I already had the namespace declared at the top of my xsp page
> <xsp:page xmlns:xsp="http://apache.org/xsp"
>           xmlns:xmldb="http://exist-db.org/xmldb/1.0">

Yes, sorry, didn't notice that.  AFAICT it should work.  Could you post
the full XSP here?

--Jeff