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

Enable Multi-Tag Convert for CSV #29

Open
inviscid opened this issue Feb 4, 2016 · 1 comment
Open

Enable Multi-Tag Convert for CSV #29

inviscid opened this issue Feb 4, 2016 · 1 comment

Comments

@inviscid
Copy link

inviscid commented Feb 4, 2016

This is a very useful tool for an XML file containing homogenous records. However, for XML files that contain various types of records, parsing all the record types requires scanning the file multiple times. For small XML files this is trivial but for larger GB sized XML files this is very slow.

Leveraging what you already have built, could you add a convert_multiple() method that would accept a list of tags and use the output path as the base path with the tag name appended. Something like this:

converter = xml2csv('some/path/my_xml.xml', 'some/path/my_csv_', encoding='utf8')
converter.convert_multiple(tags=('tag1', 'tag2', 'tag3'))

Resulting in output files like this:

my_csv_tag1.csv
my_csv_tag2.csv
my_csv_tag3.csv

@knadh
Copy link
Owner

knadh commented Feb 9, 2016

@inviscid Apologies for the delayed reply. I am afraid adding a function like that to the main library may not really fit into the scope of the project. You can always extend the class and modify its behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants