cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich Mayring <>
Subject Re: toDOM and toSAX of XMLFragment
Date Tue, 23 Jan 2001 17:37:08 GMT
Torsten Curdt wrote:
> That is your part dude! It is an interface! Only you know about the XML
> representation of the oject that implements XMLFragment!

ugghhh... you're saying I should hard-code according to the structure of
the generated XML?? What if the structure changes? Dude, don't send me
back to ASP or ColdFusion days ;-)

Ok, suppose I have XSP pages like these:

<xsp:page ...>

	String xmlstring = getXMLfromSomewhere();
	// parse it, append to current node


According to how I understand the XMLFragment interface I now have to
insert a toDOM and a toSAX method into each and every XSP page that I

Instead why not write it like this:

<xsp:page ...>

	String xmlstring = getXMLfromSomewhere();


Instead of hard-coding toDOM and toSAX methods into each and every XSP
page, I just write one CocoonMethod for strings, one for Nodes, one for
SAX events and whatever else I have as input. This method could then
determine if we're running cocoon1 or cocoon2 and initiate the
appropriate action. And what do you know: the methods I write can also
be used by others :)

> How would you do a generic toSAX method?! - There cannot be THE ONE!
> All you could do is build a DOM tree and then turn it into SAX.
> But that would be stupid!:)

How does a SAX parser parse arbitrary XML files? It reads characters and
generates events :)


Ulrich Mayring
DENIC eG, Systementwicklung

View raw message