XML doesn't allow for HTML Entities in output without a wrapping CDATA tag. Note that apostrophes and other unusual characters, even after using the following function:
views_xml_strip_illegal_chars($input)
The following xml validation error will occur:
XML Parsing Error: undefined entity
Location: http://andydev.drupal.poly.com/xml/nodes
Line Number 22, Column 21: Foo&pos;s Bar
--------------------^
Fix attatched to wrap all text nodes in CDATA tags via the XML Output theme.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | views_datasource-306066_01.patch | 1.36 KB | mbutcher |
| views-view-xml.tpl_.php_.diff | 369 bytes | Goldcap |
Comments
Comment #1
mbutcher commentedEncoding the entities as numeric values instead of shorthand codes would also work and is cross-parser capable, since it doesn't depend on HTML-specific entities.
E.g. Instead of using amp in an entity, use #38. This would be a trivial change to views_xml.module. See the attached patch.
This can be used in conjunction with the patch above, or on its own (CDATA sections won't be necessary).
Comment #2
mbutcher commentedSince this has two patches attached now, I figured I'd better change the status.
Comment #3
dalinI like the idea but your patches need a bit of work. Please also patch for XHTML and RDFa. Please roll all patches into one file (preferably using cvs diff -upNR for better readability). Please do not comment out the code that you are replacing, just remove it.
This patch is racing against #286715: Invalid xml due to incorrectly encoded greater-than symbol but this is the better approach.
cheers
Comment #4
allisterbeharry commentedThis problem is actually specific to one entity - the apostrophe ('). there was a typo in the code: I had &pos; instead of '. Fixed in alpha3: http://drupal.org/node/598242
Comment #5
allisterbeharry commented