You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Greg Weinger <gw...@itmedicine.net> on 2001/08/07 22:00:36 UTC
[C2]ReadDOMSessionTransformer patch
I have a patch for a bug in the ReadDOMSessionTransformer.
It is currently inserting an XML prolog in the middle of an XML
document, regardless of where I attempt to insert the DOM fragment.
This is because the DOMSteamer it uses automatically fires start
document/end document events. I saw in the mailing list where somebody
used the EmbeddedXMLPipe to catch these. Hence, this minor patch.
I will look further, because there may be more bugs like this in
connection with the DOMStreamer.
Below is an example of what can happen.
Here is the sitemap reference:
<map:generate type="file" src="main/result.xml" />
<map:transform type="readDOMsession">
<map:parameter name="dom-name" value="formModel"/>
<map:parameter name="trigger-element" value="body"/>
<map:parameter name="position" value="after"/>
</map:transform>
<map:serialize type="xml"/>
Here is the file I'm generating from:
<?xml version="1.0" encoding="UTF-8"?>
<page>
<title>My title</title>
<body/>
</page>
And here is the result:
<?xml version="1.0" encoding="UTF-8"?>
<page>
<title>My title</title>
<body/><?xml version="1.0" encoding="UTF-8"?>
<question_form currentID="37" id="2" sectionID="2"
xmlns:p3n="http://www.p3n.org/p3n"><question id="37" text="How often do
you travel outside the United States?" type="single-select"
vieworder="1" xmlns:p3n="http://www.p3n.org/p3n">
<answer id="7" text="1-2 weeks" vieworder="1"/>
<answer id="8" text="3-5 weeks" vieworder="1"/>
</question>
</question_form>
</page>