XML declaration printed from macro

Bug #340118 reported by Sidnei da Silva
4
Affects Status Importance Assigned to Milestone
Chamelon Core
Confirmed
Medium
Unassigned

Bug Description

I have two templates being used for generating an atom feed. The first uses a macro from the second. Whenever the second macro is used, a xml declaration is inserted into the output. This should not happen.

Revision history for this message
Sidnei da Silva (sidnei) wrote :

Attaching source template

Revision history for this message
Sidnei da Silva (sidnei) wrote :

Template for atom entry, containing just a macro

Revision history for this message
Sidnei da Silva (sidnei) wrote :

Generated output, note the xml declarations after each <entry>.

Changed in chameleon.core:
importance: Undecided → Critical
status: New → Confirmed
Revision history for this message
Sidnei da Silva (sidnei) wrote :

Downgrading, found a workaround.

Changed in chameleon.core:
importance: Critical → Medium
Revision history for this message
Sidnei da Silva (sidnei) wrote :

Looking at chameleon.core.etree, seems like the xml declaration is inserted if there's no root node (or if the macro is the root node). Adding a <metal:block> tag around the macro in feed-entry-atom.pt avoids the issue, but it's an ugly workaround.

Revision history for this message
Malthe Borch (mborch) wrote :

Whatever is in the code, what's meant to be there is the following:

If a macro is being used (use-macro) to replace the root of the template (e.g. "main_template.pt" scenario), then we'll print the XML *namespace* declarations of the used macro.

However, I believe that under no circumstances should an XML declaration <?xml ...> be printed from a macro. That makes no sense.

Perhaps we can rephrase this bug as: "XML declaration printed from macro", which is then always a bug.

Revision history for this message
Malthe Borch (mborch) wrote :

This issue needs a test.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.