letuananh/pyinkscape

Warning appears about using a specific form of xml xpaths

Opened this issue · 0 comments

This occurs in xml mode (not tested in _LXML_AVAILABLE case)

After adding some debug output (lines 1, 4, 5 and 8 below), I can see the original string sent, so we can compare it to the suggested string:

  1. [_xpath_query] xml query_string="/ns:svg/ns:g/ns:text[@id='character_name_']/ns:tspan"
  2. /home/owner/git/pyinkscape/pyinkscape/inkscape.py:529: FutureWarning: This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to "./ns:svg/ns:g/ns:text[@id='character_name_']/ns:tspan"
  3. return self.__tree.findall(query_string, namespaces=namespaces)
  4. Got no <text id="character_name_">. Trying group (potential Inkscape-generated g tag)
  5. [_xpath_query] xml query_string="/ns:svg/ns:g[@id='character_name_']/ns:tspan"
  6. /home/owner/git/pyinkscape/pyinkscape/inkscape.py:529: FutureWarning: This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to "./ns:svg/ns:g[@id='character_name_']/ns:tspan"
  7. return self.__tree.findall(query_string, namespaces=namespaces)
  8. Got no <g id="character_name_"> either

so for comparison:

  • /ns:svg/ns:g/ns:text[@id='character_name_']/ns:tspan old
  • ./ns:svg/ns:g/ns:text[@id='character_name_']/ns:tspan suggested
  • /ns:svg/ns:g[@id='character_name_']/ns:tspan old
  • ./ns:svg/ns:g[@id='character_name_']/ns:tspan suggested

However I'm not sure if you "rely on the current behaviour" so I'm not sure they should be changed to the suggested queries.