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
Added a function profile_gen to generate profile formatted output from any given xml. Fixes #5. #12
Added a function profile_gen to generate profile formatted output from any given xml. Fixes #5. #12
Conversation
…iple levels into the output
To Do:
|
Looks like python 3 build is breaking at this line (list assignment/ in place modification). Its works fine in python 2.7. I tried to resolve the issue. I haven't worked much with python 3. Appreciate if you can help .... |
Fixed the python 3 issue. Plz check and lemme know. I am working on the other 2 ToDo items |
…n the profile output
…e output as child of the element
Implemented the first todo: feature to add include_attributes flag to include the attributes in the profile output as child of the element. Also added a new test for this feature. "number", "id" would not show up if the include_attributes flag is set to false., since they are attributes of xml elements. plz review/test and lemme know your thoughts
|
I think this is great, it would be good if we can include an option on the profile_gen function for also creating the dataset stubs, i.e. title = dataset:default Can you see if you can refactor to just use the xml.etree.ElementTree without having a separate requirement for lxml. I originally chose this module as I would like the module to work without the installation of other modules (especially where there may be compilation requirements to satisfy the dependency). When creating the Perl equivalent, this ended up causing me headaches in terms of usage. I also already have the logic in the code for handling elements/attributes so that can be reused where applicable. Really appreciate your efforts, thanks again. Will aim for this and your other changes for the next release. |
Thanks very much for your feedback and being accomodating .. I see 3 asks in this ..
|
Also i would welcome any insights/suggestions/your thoughts in to class _XMLDataset refactoring .., would be useful to me and appreciated ... Also plz feel free to lemme know if anything is needed to make it easy for you to integrate this functionality. You have done great job of structuring and clean code.. i have tried to be consistent with your approach where ever i was able to.. but there is much to be desired .... |
This is fix for the issue #5
Note: This is a initial version. I also wrote a test function. The code works and the test passes.
Following the agile pattern, make it work and make it better. I have made it to work and pass tests.
I am sure there is lot of room for improvements or even a total redesign. Open to suggestions and advice.
λ python -m xmldataset
Parse using profile output :
{'title_and_author': [{'title': "XML Developer's Guide", 'author': 'Gambardella, Matthew'}, {'title': 'Midnight Rain', 'author': 'Ralls, Kim'}, {'title': 'Maeve Ascendant', 'author': 'Corets, Eva'}, {'title': "Oberon's Legacy", 'author': 'Corets, Eva'}, {'title': 'The Sundered Grail', 'author': 'Corets, Eva'}, {'title': 'Lover Birds', 'author': 'Randall, Cynthia'}, {'title': 'Splish Splash', 'author': 'Thurman, Paula'}, {'title': 'Creepy Crawlies', 'author': 'Knorr, Stefan'}, {'title': 'Paradox Lost', 'author': 'Kress, Peter'}, {'title': 'Microsoft .NET: The Programming Bible', 'author': "O'Brien, Tim"}, {'title': 'MSXML3: A Comprehensive Guide', 'author': "O'Brien, Tim"}, {'title': 'Visual Studio 7: A Comprehensive Guide', 'author': 'Galos, Mike'}]}
Profile Gen output :