Exporting valid XHTML/XML using a template?

Tell us about your wildest feature dreams. Or just harmless suggestions for improvement.
Post Reply
thajeztah
Addicted to Bruji
Addicted to Bruji
Posts: 105
Joined: Wed Aug 06, 2008 5:55 pm
Location: Netherlands

Exporting valid XHTML/XML using a template?

Post by thajeztah »

I'm experimenting a bit with creating an 'ajax' driven HTML template using data from CDPedia.

Unfortunately I'm having some problems creating a template that exports valid XML. I am aware of exporting the collection as '.pedia' file, which contains all data as XML, but I try to create a couple of XML files containing, for example, all 'artists', all 'albums' etc.

The problem is, that CDpedia does not have an option to replace XML 'special' characters with entities (e.g. replace <, >, &, " and ' with <, >, &, " etc).

As a workaround I've exported all data as XML nodes, and wrapped them in 'CDATA' sections, but would prefer to include some data as 'attribute', which is easier to handle and reduces the filesize of the XML files.

My questions;
- Does CDpedia have an option or metatag for export-templates to do this?
- If not, are there any plans to add this feature?
User avatar
Conor
Top Dog
Posts: 5345
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Exporting valid XHTML/XML using a template?

Post by Conor »

Download the beta and they will encode the characters if the text template file ends in ".xml". Another option is to use an XSLT transformation on the XML file produced by .pedia to achieve the final output. Thank you for letting me know about the incompatibility in the template XML export.
thajeztah
Addicted to Bruji
Addicted to Bruji
Posts: 105
Joined: Wed Aug 06, 2008 5:55 pm
Location: Netherlands

Re: Exporting valid XHTML/XML using a template?

Post by thajeztah »

Wow, excelent

There's 1 special character left that's not being encoded; single quotes (should be encoded as ').

This is an easy one to fix in my template though (using double quotes in stead of single ones), but I thought I should mention, just to make it complete.

I also tested if encoding works in HTML exports, and it does. Perfect!

Thanks again for this quick response. It's this extreme high level of support that makes good software even better.

Happy Holidays to you and Nora!


sebastiaan
User avatar
Conor
Top Dog
Posts: 5345
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Exporting valid XHTML/XML using a template?

Post by Conor »

Thank you for the kind words. We will add the single quote encoding for the next version.
Post Reply