0

I have a view that outputs XML either on screen (using Views Datasource) or a file (using Views Data Export), and I'm attempting to import the data generated by the view using the feeds module.

The view contains several taxonomies, some of which contain terms with an ampersand (e.g. "Finance & administration).

The datasource view outputs the term without encoding these ampersands "&", while the views data export seems to encode them regardless of the setting in the view to do it or not. (The value stored in the dB is "&", not "&amp".)

With the datasource feed import, it appears all nodes that have & in at least one term associated to the node are skipped. I say this because those nodes never even show up in the debug output (which sounds like a bug to me).

With the views data export XML file import, all the nodes are imported, but the taxonomies that accept multiple values never get set properly.

Using Feeds tamper, I have tried using html entity decode/encode, and attempted to use it before/after explode, but nothing seems to fix either issue. I believe I should focus on the XML file import since at least all nodes are being imported.

Any thoughts on what may be happening during the XML file import, and how to address the issue? All the modules are the latest stable version.

1 Answer 1

1

I am using Feeds XPath Parser to import an XML file that contains a couple of fields that I then map to terms in two different vocabularies. It looks like the parser removes ampersands before Feeds Tamper kicks in. This leaves the terms with three spaces where previously there was a space, an ampersand and another space.

My solution - was to create a Find Replace tamper plugin that looks for three spaces in the imported text and replaces the three spaces with a space, an ampersand and another space.

Not pretty, but it works. Of course, this solution won't work if there are other special characters in the feed that would also be removed. In that case, I'd create multiple Find Replace plugins that look for the specific text strings, such as "Canada Alaska" and replacing them with the corrected string, i.e. "Canada & Alaska". Even less pretty but ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.