-
Notifications
You must be signed in to change notification settings - Fork 140
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
xml2json, deeply nested, only one record in results #20
Comments
Can you post an excerpt from the XML file? |
Here's the first four records but it's still ~3000 lines: http://www.doconnel.force9.co.uk/t/sample.xml.tar.gz Btw, if you are checking the source then v3 of the db also suffers from the same conversion problem, first record only, however the second record can actually be browsed on their website. I'm still awaiting feedback from them. Thanks for looking into this problem. |
Yeah, I was able to reproduce the problem. Only the first record is converted. Let me investigate. |
Having a similar issue with the following xml: Conversion seems to stop after the second record... Let me know if I can provide any other info! |
@Zuela, that's a gigantic XML file! Do you have a smaller sample? |
Sorry about that!! Will subset that file as soon as I can!
|
@Zuela, I can confirm that only the first record gets converted, like the last issue. Not able to pinpoint where exactly the issue is. |
Hello! val = None if elem.text: val = elem.text.strip() val = val if len(val) > 0 else None + elif elem.attrib: + val = elem.attrib + val = val if len(val) > 0 else None block[elem.tag] = val return block Thanx for your work. |
@onemoretime could you please submit a pull request? |
This xml still fails even with onemoretime@d1661e0 |
@snowch, it does not fail after 1st record and it processes more than 1 record (look carefully in the resulting .json file, and do not be mislead by one field vs one record). But the issue I am facing is the script only processes up to about 26KB file size. Attached is the fruits.xml file that i made bigger for testing. and the fruits.json resulting file. I have to rename them to be accepted by this upload. |
I have found a fix for this, below code tested with python 2.7.8 - note that i commented out the old code. `
` |
fix for issue knadh#20
Thanks @dunnleaddress -- Merged a58d7be |
I'm trying to convert the data from this resource: http://www.drugbank.ca/downloads and only seem to be getting the first record (DB00001, "Lepirudin") in the conversion. However, if I use DrungBank's on-line browser to search on "Lepirudin" it finds it but throws an error when trying to view the record so this may be an XML and not xml2json problem.
The text was updated successfully, but these errors were encountered: