question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

parse-unparse does not roundtrip on mixed content model

See original GitHub issue

to simply reproduce:

import xmltodict
mix = xmltodict.parse('<mix>before <nested>inside</nested> after</mix>')
xmltodict.unparse(mix, full_document=False)

'<mix><nested>inside</nested>before  after</mix>'

the before-after text gets somehow joined into one '#text' node

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
mpf82commented, Jan 7, 2022

I wonder why xmltodict so popular. We have alternative in java .

An “alternatvive in java” is pretty useless for a Python developer.

1reaction
javadevcommented, Dec 10, 2021

It may be converted to this json

{
  "mix": {
    "#text": "before ",
    "nested": "inside",
    "#text1": " after"
  },
  "#omit-xml-declaration": "yes"
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

mixed content revisited - scalaxb
In order for the case class to round trip back to XML, it needed to store both text node and subelements in order...
Read more >
Class 05
The parser delivers character content for element foo as "blah blah ... this or StAX are the only ways to deal with huge...
Read more >
Exposing DTD Information (SAX2) - документация - unix.org.ua
Note that while a fully featured SAX2 parser will let you re-create the internal subset, it will not let you round-trip any external...
Read more >
XmlPullParser - Android Developers
XML Pull Parser is an interface that defines parsing functionality provided in ... with nextTag make it very easy to parse XML that...
Read more >
Document Object Model †DOM‡ Level 3 Content ... - W3C
This specification defines the Document Object Model Content ... Note that this may not imply that the parser actually calls the DOM's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found