You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ross Burton <ro...@mail.com> on 2000/06/09 22:11:24 UTC

[C2] Problem with DOMBuilder

Okay guys, please help me here!

I'm writing a DOM wrapper (attached) around the Filter interface, so that I
can write other filters in DOM mode (initially for SVG stuff which has a DOM
defined).  It implements DOMBuilder to build the DOM from SAX events,
DOMBuilder.Listener.notify() is called which does work (here set the title
of the SVG to "Foo") and uses DOMStreamer to send SAX events.

I create a SVGDocument svg from the Document doc supplied in notify().  If I
call streamer.stream(doc) the serializer gets the original document, none of
the modifications made on svg have affected doc.  If I call
streamer.stream(svg) I get this stack trace:

java.lang.NullPointerException
        at java.lang.Throwable.<init>(Throwable.java:84)
        at java.lang.Exception.<init>(Exception.java:35)
        at org.xml.sax.SAXException.<init>(SAXException.java:61)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:834)
        at
org.apache.cocoon.components.parser.XercesParser.parse(XercesParser.java)
        at
org.apache.cocoon.generators.FileGenerator.generate(FileGenerator.java)
        at
org.apache.cocoon.sitemap.GenericProcessor.process(GenericProcessor.java)
        at
org.apache.cocoon.sitemap.SitemapPartition.process(SitemapPartition.java)
        at org.apache.cocoon.sitemap.Sitemap.process(Sitemap.java)
        at org.apache.cocoon.Cocoon.process(Cocoon.java)
        at
org.apache.cocoon.command.CocoonCommand.<init>(CocoonCommand.java)
        at org.apache.cocoon.command.CocoonCommand.main(CocoonCommand.java)
Class: org.xml.sax.SAXException
Message: null
java.lang.NullPointerException
        at org.csiro.svg.dom.SVGDocumentImpl.<init>(SVGDocumentImpl.java)
        at
org.apache.cocoon.serializers.SVGSerializer.notify(SVGSerializer.java)
        at
org.apache.cocoon.xml.util.DOMBuilder.endDocument(DOMBuilder.java)
        at
org.apache.cocoon.sitemap.LinkTranslator.endDocument(LinkTranslator.java)
        at org.apache.cocoon.filters.LogFilter.endDocument(LogFilter.java)
        at
org.apache.cocoon.sitemap.LinkTranslator.endDocument(LinkTranslator.java)
        at
org.apache.cocoon.xml.util.DOMStreamer.setDocument(DOMStreamer.java)
        at
org.apache.cocoon.xml.util.DOMStreamer.processNode(DOMStreamer.java)
        at org.apache.cocoon.xml.util.DOMStreamer.stream(DOMStreamer.java)
        at org.apache.cocoon.filters.DOMFilter.notify(DOMFilter.java)
        at
org.apache.cocoon.xml.util.DOMBuilder.endDocument(DOMBuilder.java)
        at
org.apache.cocoon.sitemap.LinkTranslator.endDocument(LinkTranslator.java)
        at
org.apache.xerces.parsers.SAXParser.endDocument(SAXParser.java:1222)
        at
org.apache.xerces.validators.common.XMLValidator.callEndDocument(XMLValidato
r.java:618)
        at
org.apache.xerces.framework.XMLDocumentScanner$EndOfInputDispatcher.dispatch
(XMLDocumentScanner.java:1545)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:380)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:817)
        at
org.apache.cocoon.components.parser.XercesParser.parse(XercesParser.java)
        at
org.apache.cocoon.generators.FileGenerator.generate(FileGenerator.java)
        at
org.apache.cocoon.sitemap.GenericProcessor.process(GenericProcessor.java)
        at
org.apache.cocoon.sitemap.SitemapPartition.process(SitemapPartition.java)
        at org.apache.cocoon.sitemap.Sitemap.process(Sitemap.java)
        at org.apache.cocoon.Cocoon.process(Cocoon.java)
        at
org.apache.cocoon.command.CocoonCommand.<init>(CocoonCommand.java)
        at org.apache.cocoon.command.CocoonCommand.main(CocoonCommand.java)
Class: java.lang.NullPointerException
Message: null

Which is because for some reason the SVGDocument object (which extends
DocumentImpl from Xerces) has no child elements (LogFilter revealed the
events sent from DOMFilter to be startDocument, endDocument).  Is this a
weird bug in the CSIRO SVG code? It only adds SVG methods and doesn't
override any of the XML DOM methods so they should really be working!

Help!  :-)

Ross