You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Sebastien Sahuc <ss...@imediation.com> on 2000/10/07 19:56:07 UTC

RE: [C2][Xalan2] Transformation failure if SAX events generated p rogramatically

dims wrote :
> We have some code that generates SAX
> events which need to be fed to the Transformer (instead of 
> reading from an XML file). This
> produces invalid output. Enclosed is the code and sample 
> based on SAX2SAX. 

> Note that if you use
> foo.xml which is exactly the XML generated by the code 
> programatically then you get valid output.

Well not exactly the same. Indeed there are ONE BIG difference in the way
both method deal with namspaces :
If you put a simple filter between the StatusGenerator and the transfomer
that trace the contentHandler's methods, you'll get :

  startDocument
  startPrefixMapping(, http://apache.org/cocoon/2.0/status)
  startPrefixMapping(xlink, http://www.w3.org/1999/xlink)
  startElement(http://apache.org/cocoon/2.0/status, statusinfo, statusinfo
...
  startElement(http://apache.org/cocoon/2.0/status, group, group ...
[and so on ...]

Whereas if you put the same filter between the XMLReader (parser) and the
transformer the trace change a little bit:

  setDocumentLocator
  startDocument
  startElement(, statusinfo, statusinfo ...
  startElement(, group, group ...

So the output is not the same.. far away to be the same. I would even say
that they are completely different ! :-)

Sebastien