I'm using explode to split a comma-separated list of items within an XML node and then use the results as taxonomy terms. I'm finding that if the list contains integers these are not appearing in the output. Details as follows.
When using explode on a list like this:
<some-element>123,1.23,abc,456 ,789,def890</some-element>
I get back (in the field to which the node is mapped):
1.23, abc, 456, def890 as the exploded values.
123 and 789 are not processed
Looks as though values which could be interpreted as integers are not being output.
In the example the trailing space after 456 ensures that it is output whereas 123 and 789 go awol. I've worked around the issue by ensuring that all comma-separated items are also followed by a trailing space.
Comments
Comment #1
twistor commentedI am unable to reproduce this. Could it be a PHP bug? What are these getting mapped too?
Comment #2
urbanbassman commentedHi @twistor
PHP is 5.2.9 running as an Apache module. ISP is www.blacknight.com
Let me know if there's anything from phpinfo() that would be useful.
I've reproduced the issue on a fresh install of Drupal at http://drupal.codepages.net/
See http://drupal.codepages.net/node/18 for a detailed description of the issue with screenshots of the settings I'm using.
Issue isn't confined to integers -- I got that wrong. Various number formats seem to be affected.
The original example should read:
<some-element>123,1.23,abc,456 ,789,def890</some-element>
I get back (in the field to which the node is mapped):
abc, 456, def890 as the exploded values (doesn't include 1.23 as per my original post).
Comment #3
twistor commentedThis just dawned on me, Feeds thinks that the number is the term id, and is trying to look it up, rather than mapping it. Could that be the problem?
Comment #4
tonkatuph commented@Twister, I am having the same problem and I agree with your follow up. How would I go about correcting that?
Comment #5
twistor commentedIn reality, Feeds is being too clever, and there should be two mappings, one for term name, and one for term id. In the short term, it would be trivial to create a new target that looks only for the term name.
Comment #6
twistor commented#1019688: Taxonomy mapper options: term name +tid, term name, tid, guid (avoids mapping error for Numeric taxonomy term, too)
Comment #7
twistor commentedClosing this, as it's out of my hands.