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

deps: update quick-xml dependency #12

Closed
decathorpe opened this issue Jun 22, 2023 · 6 comments
Closed

deps: update quick-xml dependency #12

decathorpe opened this issue Jun 22, 2023 · 6 comments

Comments

@decathorpe
Copy link
Member

The quick-xml dependency is currently pinned to v0.25, while upstream has already released v0.29.
However, I'm not sure how to handle some of the breaking changes since v0.25:

  1. The $text attribute (added in v0.28.0) breaks the new custom Value deserializer (though adding a case for "$text" to the match statement seems to solve that (not sure if that's correct, but it seems to work 😕)
  2. quick-xml now defaults to writing self-closing XML tags when serializing empty strings (i.e. empty string values are written as <value><string /></value> and empty bytes are written as <value><base64 /></value>. While this is valid XML and should be acceptable for XML-RPC, it's inconsistent with other implementations

I've checked how Python's xmlrpc module handles this (see below) - it supports reading XML with self-closing tags, but it does not seem to ever write them. I don't think there's a way to control this behaviour from the quick-xml serializer side (without writing a custom serializer ...)


import xmlrpc.client
xmlrpc.client.loads("<params>\n<param>\n<value><string /></value>\n</param>\n</params>\n")
# (('',), None)
xmlrpc.client.loads("<params>\n<param>\n<value><string></string></value>\n</param>\n</params>\n")
# (('',), None)
xmlrpc.client.dumps(("",))
# '<params>\n<param>\n<value><string></string></value>\n</param>\n</params>\n'
@decathorpe
Copy link
Member Author

@bahlo You seem to have more experience with weird XML-RPC clients / servers than me - do you think it would be an issue if dxr clients / servers started sending XML-RPC messages that contained self-closing XML tags for empty strings / bytes?

@decathorpe
Copy link
Member Author

decathorpe commented Jun 22, 2023

Correction: quick-xml seems to write <string/> and <base64/> without a space before />. It looks weird to me for some reason, but it appears to be valid XML 1.0 syntax.


EDIT: 407a3a1 is how far I've gotten. I needed to adapt some tests for the behaviour change, but everything else still seems to work.

@bahlo
Copy link
Contributor

bahlo commented Jun 22, 2023

Hah yeah I sadly do—the server I‘m interfacing with is using XMLRPC++ 0.7 and does not support self-closing xml tags so I‘d selfishly advise to not use that feature 🥸

@decathorpe
Copy link
Member Author

For some reason I suspected as much 😓
I opened an issue with quick-xml upstream, maybe this can be worked around somehow:
tafia/quick-xml#617

@decathorpe
Copy link
Member Author

quick-xml v0.30 was released with the new API.

This commit updates the dependency and adjusts the code accordingly:
ee87998

Will be part of the upcoming (soon!) v0.6.0 release.

@bahlo
Copy link
Contributor

bahlo commented Jul 28, 2023

appreciate it!

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

2 participants