Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process path within an explicit SVG namespace #135

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion svgpathtools/svg_to_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def dom2dict(element):
return dict(list(zip(keys, values)))

# Use minidom to extract path strings from input SVG
paths = [dom2dict(el) for el in doc.getElementsByTagName('path')]
paths = [dom2dict(el) for el in doc.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'path')]
d_strings = [el['d'] for el in paths]
attribute_dictionary_list = paths

Expand Down
7 changes: 7 additions & 0 deletions test/namespaces.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions test/test_svg2paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,12 @@ def test_svg2paths_ellipses(self):
self.assertTrue(len(path_circle)==2)
self.assertTrue(path_circle==path_circle_correct)
self.assertTrue(path_circle.isclosed())

def test_svg2paths_namespaces(self):

paths, _ = svg2paths(join(dirname(__file__), 'namespaces.svg'))
self.assertTrue(len(paths)==1)


if __name__ == '__main__':
unittest.main()