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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mbutcher’s picture

Encoding 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).

mbutcher’s picture

Status: Active » Needs review

Since this has two patches attached now, I figured I'd better change the status.

dalin’s picture

Version: 6.x-1.0-alpha2 » 6.x-1.x-dev
Status: Needs review » Needs work

I 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

allisterbeharry’s picture

Status: Needs work » Fixed

This 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

allisterbeharry’s picture

Version: 6.x-1.x-dev » 6.x-1.0-alpha2
Assigned: Unassigned » allisterbeharry

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.