When creating an XML view, if the body of a node contains a  , that body XML element will be blank, rather than containing the actual content. Stripping html tags in the field makes no difference. Other html entities such as & do not cause the issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nd987’s picture

UPDATE -- this only occurs when the 'plaintext output' option is checked in the output style options.

atomicjeep’s picture

This also happens when you expose a default node body field

atomicjeep’s picture

I think this seems to relate to the optimisation of check_plain() which was added as of Drupal Core 6.17

lhugg’s picture

Version: 6.x-1.0-beta2 » 6.x-1.x-dev
Issue tags: +JSON XML &nbsp

This is also true for the JSON module. Both the Body and Teaser fields are = " ", even if plaintext is checked. The raw output option will output the content, which leads me to believe that comment 3 above is correct. Of course, raw output leaves us (or the recipient of the JSON file) open to vulnerabilities.

Can this be fixed in this module, or do we need to look elsewhere or somehow override within our own app?

Also, should this be a separate issue for JSON, or is it OK here?

IncrediblyKenzi’s picture

As I recall,   doesn't have a default entity in XML, so it needs to be defined as part of the dtd.   is the alternative, and works without the schema.

clemens.tolboom’s picture

I don't get the following grep on the code where function _views_xml_xmlEntities($str) is supposed to replace entities by their numeric variant.

grep -r _views_xml_xmlEntities *
theme/views_views_xml_style.theme.inc:
   $content = ($plaintext_output ? check_plain(html_entity_decode(strip_tags($object->content))) : _views_xml_xmlEntities($object->content));

theme/views_views_xml_style.theme.inc:
  $content[$n] = ($plaintext_output ? check_plain(html_entity_decode(strip_tags($oc))) : _views_xml_xmlEntities($oc));		    		

theme/views_views_xml_style.theme.inc:
  $content = ($plaintext_output ? check_plain(html_entity_decode(strip_tags($object->raw))) : _views_xml_xmlEntities($object->raw));

theme/views_views_xml_style.theme.inc:
  foreach($object->raw as $n=>$oc) $content[$n] = ($plaintext_output ? check_plain(html_entity_decode(strip_tags($oc))) : _views_xml_xmlEntities($oc));

views_xml.module:function _views_xml_xmlEntities($str)

Only when not $check_plain the call to function _views_xml_xmlEntities($str) is done.

Based on this observation I managed to run strip tags on the node.teaser and leave XML config not to checkplain.

clemens.tolboom’s picture

Status: Active » Needs review
FileSize
2.41 KB

The attached patch solve the nbsp problem by always apply the _views_xml_xmlEntities call as we _are_ in an xml context right?

ZeiP’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

This isn't happening for me in the D7 version. As D6 has been EOL for a few years now, closing the issue as outdated.