Ugo Cei wrote: > Guido Casper wrote: >> I have no idea what the reason might be but maybe you want to try: >> org.apache.cocoon.components.source.SourceUtil.toDOM(source); > > I already found a workaround: > > var domBuilder = new Packages.org.apache.cocoon.xml.dom.DOMBuilder(); > source.toSAX(domBuilder); > return domBuilder.document; > > (BTW, what's the difference between my version and yours?)
SourceUtil.toDOM() uses the same code, but calls source.toSAX() only if it exists (i.e. the source implements XMLizable). If not, SourceUtil falls back to using the XMLizer (which in turn calls source.getInputStream again). So SourceUtil works with any kind of source while your code does only work on sources implementing XMLizable. Guido