cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <>
Subject Re: Merging CForm's DOMHelper with DOMUtil?
Date Fri, 15 Oct 2004 23:44:00 GMT
Bart Molenkamp wrote:
> I need to parse XML files to documents.

Why don't you use SourceResolver and SourceUtil?

> I found out that CForm's
> DomHelper class could be very useful for that, mostly because it records
> line and character positions of nodes. Isn't this useful for other
> Cocoon parts as well? Thus making this class more globally available in
> Cocoon? Or maybe merge it with DOMUtil?

Unfortunately, this works only with Xerces, and it works only with Xerces DOM 
documents, and only when those documents were created by the method in this helper.

Moreover, this helper will fail with ClassCastException if "foreign" DOM is 
passed instead of degrading gracefully. Even worse, it will fail with 
NoClassDefFoundError if Xerces isn't in the classpath.

In short, there is some refactoring required in order to make it possible to 
bring this functionality into the DOMUtil. But, some of the methods could easily 
be moved into the DOMUtil.

This also shows that CForms currently do some unefficient double parsing if 
XMLizable source is passed to it.

This also makes me think; LocationTrackingDOMParser could be an alternative 
implementation of cocoon.xconf's <xml-parser/>, making location information 
available globally in Cocoon.


View raw message