Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampersand breaks templates? #3

Open
Wattaged opened this issue Jul 23, 2020 · 2 comments
Open

Ampersand breaks templates? #3

Wattaged opened this issue Jul 23, 2020 · 2 comments

Comments

@Wattaged
Copy link

Hi Flibbles
Still enjoying your very useful plugin, thanks.
Tried a template today and couldn't get it to work, after filtering through the xml content it seems the '&' ampersand was the problem.
Tested and reproduced it on your demo site on 'Examples/Rendering/Process.xml' - if you put an & after Martha the template breaks. I've got urls in my xml content with '&' in so thought I'd raise it in case there was an easy fix.
Otherwise still working well, thanks a lot.

@flibbles
Copy link
Owner

Putting plaintext ampersands in text (<book>Strunk & White</book>) is illegal in XML. If you need to do it, there are two ways:

<book>Strunk &amp; White</book>

or

<book><![CDATA[Strunk & White]]></book>

tw5-xml can handle either of these cases.

Unfortunately, it's not great about telling you why any particular XML document is bad, so sorry you had to take time to track this down. Problem is, the DOM engines on all the different browsers (and NodeJS) all handle erroneous XML in different ways, so that's a bag of cats I've been afraid to open.

@Wattaged
Copy link
Author

Thanks for the explanation and remedies. Not looking to cause you work, leave those cats in the bag and I'll try your solutions. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants