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

xmlgen should ignore non-supported XML w/ a warning #256

Open
zeenix opened this issue Mar 30, 2022 · 4 comments
Open

xmlgen should ignore non-supported XML w/ a warning #256

zeenix opened this issue Mar 30, 2022 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers zbus_xmlgen

Comments

@zeenix
Copy link
Contributor

zeenix commented Mar 30, 2022

Creating a separate issue for the simpler/bug part of #255. As discussed there, we should ignore any unexpected XML with a warning on the standard error output, instead of just completely giving up.

@zeenix zeenix added good first issue Good for newcomers and removed 4. newcomers labels May 13, 2023
@kb-1000
Copy link

kb-1000 commented May 10, 2024

As far as I've seen so far, the convention with XML usually tends to be silently ignoring elements and attributes from unknown namespaces, which are usually used for ignorable vendor/etc. extensions, see for example JAXB's XML schema binding extensions that no one other than JAXB needs or reads, or some of LibreOffice's OpenDocument extensions. A warning is probably not necessary or desirable, as long as the known elements and attributes are okay, an info/debug-level message controlled by a verbose mode would make more sense.

@zeenix
Copy link
Contributor Author

zeenix commented May 12, 2024

A warning is probably not necessary or desirable

I disagree but that's not important. The important bit is to ignore unknown elements. Do you think you can contribute this?

@kira-bruneau
Copy link

kira-bruneau commented Nov 8, 2024

It looks like this won't be straightforward to fix. quick-xml doesn't distinguish between namespaces when using serde deserialization: tafia/quick-xml#757, so zbus_xml will have to be refactored to use something like NsReader or xmlserde.

@zeenix
Copy link
Contributor Author

zeenix commented Nov 8, 2024

It looks like this won't be straightforward to fix.

Yeah, definitely not. :(

quick-xml doesn't distinguish between namespaces when using serde deserialization: tafia/quick-xml#757,

More like tafia/quick-xml#218 .

so zbus_xml will have to be refactored to use something like NsReader or xmlserde

Yeah. Also xml crate might not be a bad idea to try. It's not serde and we'll need more manual deserialization code but you can't have it all I guess.

There is also the option of people needing this, to work on tafia/quick-xml#218 getting fixed. I know that's a tall order but at least there is already some WIP work on that done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers zbus_xmlgen
Projects
None yet
Development

No branches or pull requests

3 participants