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

Child Order Not Maintained with Different Tags #22

Open
nlevitt opened this issue Jan 30, 2019 · 3 comments
Open

Child Order Not Maintained with Different Tags #22

nlevitt opened this issue Jan 30, 2019 · 3 comments

Comments

@nlevitt
Copy link

nlevitt commented Jan 30, 2019

The claim was made that jxmlease does not have the same problem as xmltodict on martinblech/xmltodict#182. But that does not seem to be true. 😭

>>> import jxmlease
>>> s = '''
... <foo>
...   <a>one</a>
...   <b>two</b>
...   <a>three</a>
... </foo>
... '''
>>> print(jxmlease.parse(s).emit_xml())
<?xml version="1.0" encoding="utf-8"?>
<foo>
    <a>one</a>
    <a>three</a>
    <b>two</b>
</foo>
@stacywsmith
Copy link
Contributor

My apologies! I do consider this a bug. jxmlease should handle this situation. Unfortunately, this project is no longer part of may day job so it may be several weeks before I can look at resolving this issue.

@fedorov
Copy link

fedorov commented Jul 18, 2019

Would be great to have this fixed...

@rsmekala
Copy link
Contributor

rsmekala commented Dec 6, 2019

I looked into the issue, the parsed_xml object is attached below.

{'foo': {'a': XMLListNode(xml_attrs=OrderedDict(), value=[XMLCDATANode(xml_attrs=OrderedDict(), value='one'), XMLCDATANode(xml_attrs=OrderedDict(), value='three')]),
         'b': XMLCDATANode(xml_attrs=OrderedDict(), value='two')}}

According to me, to achieve the desired results XMLListNode should also have another attribute to remember element <b>. Then, the same would have to be used while emitting the XML. This would take a lot of effort to achieve the desired result this way.

@stacywsmith Do you have any other ideas to achieve the use-case ??

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

4 participants