-
Notifications
You must be signed in to change notification settings - Fork 31
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
Attribute namespaces are not preserved #13
Comments
@jethrogb if you still care about this issue, I believe I've solved it in #33. It requires a semver-breaking API change. To make the upgrade more comfortable for API consumers I threw the entire weight of modern Rust trait derivation behind my newtype: Lines 9 to 13 in 03bc802
Going even farther for users of old versions of @eminence's API, I decided to delegate all functions of Lines 24 to 39 in 03bc802
There is no way within Lines 41 to 47 in 03bc802
I added finally the obvious opposite trait ( Line 49 in 03bc802
Due to the care taken to make the upgrade seamless I hope @eminence approves. |
I'm experiencing the same issue, and dropping namespaces in attributes is a bit of a deal-breaker. Is there an ETA on when the PR will be merged or a known blocker to the merge? Switching to the PR repository instead of the crates.io version fixed the issue and did not cause any incompatibility with my existing codebase. |
@adri326 If you're interested, I just pushed the two changes I was missing from this master branch and reconciled #19 with my master at MFEK/xmltree.rlib in MFEK/xmltree.rlib@8ca231c and MFEK/xmltree.rlib@447dcd6. Hopefully the MFEK branches don't need to be a long-term solution for you, but they can be. The tests do pass. The work by @dyst5422 looked fine to me so that's why I merged it. |
This commit aims to fix eminence#13 (Attribute namespaces are not preserved). It changes the type of the `attributes` map on the `Element` struct from a String -> String map to an AttributeName -> String map. AttributeName is a re-export of the xml::name::OwnedName type in xmltree-rs, which is a struct containing the attribute's local name, namespace and prefix. It is possible to search the `attributes` map using a fully initialised AttributeName structure, but for convenience get_attribute(), get_mut_attribute() and take_attribute() methods, modelled on the *_element() equivalent are provided, which take an AttributePredicate. Ready-made implementations taking either a local name or local name + namespace are provided.
Hey there! I just stumbled upon this issue (that reading an xml file with this library, manipulating the in memory tree and writing it back out to a file causes attribute namespaces to get lost, see also: https://gitlab.com/thomas351/xml-sorter-rs ) I read above that @ctrlcctrlv maintains a fork that fixes that issue, so I've switched my dependency to that repository: https://github.com/MFEK/xmltree.rlib - works fine :) Would be great if the fix could be merged into a crates.io release. |
Thanks for the bump. It sounds like the fix from @ctrlcctrlv in #33 has some good reviews and successful usage in their fork. I'll try to review these changes and get some stuff merged soon. Thanks for your patience. |
My fork works fine for my use case (and the use cases of many others) but the issues raised by @tombailo and others are serious concerns as the whole point of namespaces is being able to have the same XML attr name provided by two different DTD's. @tombailo made an attempt to patch overtop #33 in #38. We could really use a discussion between all of us on how to move forwards, I hadn't make progress as you'd not been around but the code in #38 looks like it may be workable and fix all issues but is a radical change. |
Attributes can have namespaces, such as in:
(full XML at https://www.testshib.org/metadata/testshib-providers.xml)
The
xml
namespace on thelang
attribute is not stored:The text was updated successfully, but these errors were encountered: