Page 1 of 1

Exporting valid XHTML/XML using a template?

Posted: Sat Dec 13, 2008 2:33 pm
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?

Re: Exporting valid XHTML/XML using a template?

Posted: Sun Dec 14, 2008 7:45 am
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.

Re: Exporting valid XHTML/XML using a template?

Posted: Mon Dec 15, 2008 6:23 pm
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

Re: Exporting valid XHTML/XML using a template?

Posted: Tue Dec 16, 2008 4:44 am
by Conor
Thank you for the kind words. We will add the single quote encoding for the next version.