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

Bug or intended? #7

Closed
KleinerNull opened this issue Sep 8, 2016 · 3 comments
Closed

Bug or intended? #7

KleinerNull opened this issue Sep 8, 2016 · 3 comments
Labels

Comments

@KleinerNull
Copy link
Contributor

KleinerNull commented Sep 8, 2016

I've tested different structured xml tree and I found something unexpected. The code is in this notebook.

My problem is in cell 5.

Has that something to do with XML itselfs and the underlying elementtree implementation? So, bug or intended?

@spurin
Copy link
Owner

spurin commented Oct 12, 2016

Hi KleinerNull,

I tried recreating this myself but your code seemed to work as expected, could you let me know more about your notebook setup so I can investigate further please. Here's my output from a non repl environment:

from xmldataset import parse_using_profile
from sys import version
print(version)

xml2 = """<?xml version="1.0"?>
<data>
    <colleagues>
        <summary>
            <min_colleagues>2</min_colleagues>
            <current_colleagues>3</current_colleagues>
            <max_colleagues>6</max_colleagues>
        </summary>
        <colleague>
            <title>The Boss</title>
            <phone>+1 202-663-9108</phone>
            <email>boss@the_company.com</email>
        </colleague>
        <colleague>
            <title>Admin Assistant</title>
            <phone>+1 347-999-5454</phone>
            <email>admin@the_company.com</email>
        </colleague>
        <colleague>
            <title>Minion</title>
            <phone>+1 792-123-4109</phone>
            <email>minion@the_company.com</email>
        </colleague>
    </colleagues>
</data>"""

profile2 = """
data
    colleagues
        summary
            min_colleagues = dataset:summary
            current_colleagues = dataset:summary
            max_colleagues = dataset:summary
        colleague
            title = dataset:colleagues
            phone = dataset:colleagues
            email = dataset:colleagues"""

print(parse_using_profile(xml2, profile2))

And output as follows

3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
{'colleagues': [{'phone': '+1 202-663-9108', 'title': 'The Boss', 'email': 'boss@the_company.com'}, {'phone': '+1 347-999-5454', 'title': 'Admin Assistant', 'email': 'admin@the_company.com'}, {'phone': '+1 792-123-4109', 'title': 'Minion', 'email': 'minion@the_company.com'}], 'summary': [{'current_colleagues': '3', 'max_colleagues': '6', 'min_colleagues': '2'}]}

@KleinerNull
Copy link
Contributor Author

Very strange, it worked for me in python3, python2 and ipython. Just the jupyter notebook version 4.1.0 doesn't delivered any results. After upgrading it to 4.2.3 it worked as intended.

Sry for not testing it on non notebooks, it is just my regular tinkering before production place ;)

@spurin
Copy link
Owner

spurin commented Oct 13, 2016

No problems, glad this is resolved :-) closing issue

@spurin spurin closed this as completed Oct 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants