Carsten Ziegeler said the following on 23/5/07 21:43:
If I see this correctly, the difference between the two solutions is that in the not working case, the DOMBuilder is used to build the DOM whereas in the working case, the serializer is used and the result is then parsed again.

As Marc said, you're right.

As you suggested offline I've tried serializing the output of the pipelineUtil.toDOM to a file and do a diff. The result is: the files are identical except that elements with multiple attributes have a different order of the attributes.

Just to be sure that I didn't disguise any errors by the way I saved the files, here's what I did [1].

Notes:
- pipeline is simple xml-generator + xsl-transformer + xml-serializer, all default stuff. The only thing different is the parameter of namespace prefix=true in cocoon.xconf for the xml-parser.

- BTW this leads to NAMESPACE PREFIX!!!!!!!!!!!!!!!!!!!!!!!!!! lines in the console. Is that what you were referring to in your other post?

So unless I have done the process of saving wrong, I don't see a difference between the two files.

Bye, Helma

-----
[1]
FILE1 = display above pipeline in firefox -> view page source -> copy & paste to texteditor -> save

FILE2 =
var document = pipelineUtil.processToDOM("AddIDsPipeline/" + formFileName, {});
_saveDocument(document, _makeTargetURI(documentURI));


_saveDocument(document, uri) {
...
resolver = cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);
        source = resolver.resolveURI(uri);

var tf = Packages.javax.xml.transform.TransformerFactory.newInstance();

if (source instanceof Packages.org.apache.excalibur.source.ModifiableSource && tf.getFeature(Packages.javax.xml.transform.sax.SAXTransformerFactory.FEATURE)) {

            outputStream = source.getOutputStream();
            var transformerHandler = tf.newTransformerHandler();
            var transformer = transformerHandler.getTransformer();

transformer.setOutputProperty(Packages.javax.xml.transform.OutputKeys.INDENT, "true");

transformer.setOutputProperty(Packages.javax.xml.transform.OutputKeys.METHOD, "xml"); transformerHandler.setResult(new Packages.javax.xml.transform.stream.StreamResult(outputStream));

var streamer = new Packages.org.apache.cocoon.xml.dom.DOMStreamer(transformerHandler);
            streamer.stream(document);
...
}

Reply via email to