Giacomo,
we need to switch on the
"http://xml.org/sax/features/namespace-prefixes"
flag in XercesParser.java to get xmlns:map to show up properly, this will
fix getting "XMLSerializers problem with namespaces" to work, But leads to
more problems with "XalanTransformers problem with namespaces". More details
are below.
Thanks,
dims
Problem #2 - "XMLSerializers problem with namespaces": In XercesParser.java,
add switch on one more flag as shown below then
xmlns:map="http://apache.org/cocoon/sitemap/1.0" will show up when you point
to http://localhost:8080/cocoon/sitemap?cocoon-view=content
public void parse(InputSource in)
throws SAXException, IOException {
SAXParser p=new SAXParser();
p.setFeature("http://xml.org/sax/features/validation",false);
p.setFeature("http://xml.org/sax/features/namespaces",true);
// Add the following line to get the map:xmlns tags.
p.setFeature("http://xml.org/sax/features/namespace-prefixes",true);
p.setProperty("http://xml.org/sax/properties/lexical-handler",
super.lexicalHandler);
p.setErrorHandler(this);
p.setContentHandler(super.contentHandler);
p.parse(in);
}
Problem #1 - "XalanTransformers problem with namespaces" : If the flag is
added as shown above then pointing to URL
http://localhost:8080/cocoon/sitemap has an exception.
org.xml.sax.SAXException: Prefix not declared
at
org.apache.cocoon.xml.NamespacesTable.resolve(NamespacesTable.java:214)
at
org.apache.cocoon.xml.DocumentHandlerWrapper.startElement(DocumentHandlerWrapper.java:142)
at
org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1371)
at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:823)
at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1852)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1000)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
at
org.apache.cocoon.components.parser.XercesParser.parse(XercesParser.java:41)
at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:31)
at
org.apache.cocoon.sitemap.ResourcePipeline.process(ResourcePipeline.java:164)
....
....
Davanum Srinivas wrote:
>
>Does anyone have samples to recreate the following problems?
>
>- XalanTransformers problem with namespaces
If you put the following snippet into a pipeline of your sitemap
and request it as http://localhost:8080/cocoon/sitemap you'll see, that
there is only an empty body returned as output because of the namespace
problem. If you define the xt transformer and use that instead of the
XalanTransformer all will work correctly.
>- XMLSerializers problem with namespaces
Using the above pipeline snippet you can use the following uri
http://localhost:8080/cocoon/sitemap?cocoon-view=content to see that the xml
serializer swallows all the namespaces definitions.
Giacomo
PS: You will need the lates CVS because I've had to commit a missing css
file to make the example above working.
--
PWR GmbH, Organisation & Entwicklung Tel: +41 (0)1 856 2202
Giacomo Pati, CTO/CEO Fax: +41 (0)1 856 2201
Hintereichenstrasse 7 Mobil: +41 (0)78 759 7703
CH-8166 Niederweningen Mailto:Giacomo.Pati@pwr.ch
Web: http://www.pwr.ch
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.