Needs review
Project:
Taxonomy import/export via XML
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Mar 2009 at 13:35 UTC
Updated:
8 Dec 2010 at 15:03 UTC
Jump to comment: Most recent file
Comments
Comment #1
dman commentedI've not seen that, and can't think of any code that would do that.
Can you post your sample input file?
Note that a bare '&' in text would be invalid XML in the first case... Is the input valid?
Comment #2
sissi1212 commentedMy runs well but there is no space between debate & culture for example, on drupal in categories I have debate&culture.
Comment #3
dman commentedComment #4
dman commentedComment #5
sissi1212 commentedHere is my file and thank you for your responsiveness. :)
Comment #6
dman commentedYou are totally right.
Unpredicted effect there :-/
What is happening is
<name>Culture & debates</name>goes through the XML tokenizer and produces
[tag][text][entity][text][endtag]... but (for reasons I'm sure were pretty obvious at one time) every token is being trimmed as it is found.
so
[tag][text(space)][entity][(space)text][endtag]becomes
[tag][text][entity][text][endtag]:-/
Here's a quick attempt at a fix.
I'm falling asleep here, so may have made a blunder, but it does attack the symptom
Comment #7
niQo commentedHello dman,
I have tried your patch, it resolve " & " issue but have big side effects.
here is the result of my test : (by importing section.txt uploaded by sisi12 (comment #5) )
- an empty term is added
- term hierarchy is broken : there is no parent term for imported terms
Comment #8
brad.bulger commentedit seemed to work OK for me. i modified it slightly to change the assignments but i'd be surprised if that made much of a difference. i verified that it works against the 2.x-dev release as well. (i did get some strange behavior importing the section.txt file involving node types but that's a different issue.)
i also found that having ampersands in your synonym names causes problems - the export function wasn't escaping entities in the synonyms tag value, so the parser coughs on them when it tries to import the result. i ran the list through check_plain() and that seemed to fix it. i'm not sure the full implications of that, but that's what it was doing for the other tags so it seemed safe enough.
Comment #9
chrism2671 commentedI'm having problems also related to & - here's a file I've exported- it refuses to reimport it.
Comment #10
humanchimp commented#8 works fine for me
Comment #11
medieval111 commentedWhen using the patch in #8, you can't import a hierarchical vocabulary anymore.
I made another (standalone) patch, which fixes both problems.
Comment #12
copini commentedThe patch in #11 causes every term to end with a newline character which screws up tag matching.
This new patch that will just trim every whitespace character except a normal space, simple but effective:
Comment #13
hobo commentedI'm seeing this problem as well.
Except that when you export a taxonomy, terms in synonyms that have an & do not get encoded as &
When importing it causes an error when it hits that &..
(i'm also seeing 'term & end' gets imported as 'term&end')