-
Notifications
You must be signed in to change notification settings - Fork 148
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
Unique identifier for <item> containers #7
Comments
Excellent suggestion. As a preliminary stab at how to do this, consider the following example dict:
If we want to give each element a unique id and have the ids of list items increment, how about something like the following XML output:
The What do you think? Does this meet your needs/expectations? If so, I'll be happy to push this change to production. To enable it, one would assign
The default behaviour will remain the same as it is today so as not to break compatibility for existing uses. |
I think that sounds good. I will be implementing the bulk of my XML functions soon, so I will let you know if anything else comes to mind. Thanks again. |
This feature is added in v. 1.1. Thanks again for suggesting it! |
Add some way to uniquely identify consecutive tag pairs in the same nested level. As per your suggestion, an incremented tag attribute should do the trick.Should probably be optional with a flag passed to dicttoxml().
I assume the unique id will be akin to the item/array index number that the tag represents, and will reset for each nested level. (globally unique seems silly, but on that note..)
A longer term goal might be to accept an iterator from the user at the beginning of each sequence; leaving flexibility open without excessive complication. The trick might be embedding the iterator. Maybe perform a typecheck on the 0th index of any sequence, and if a custom class instance is found, pop it from the sequence and process it as an attibute value iterator.
We can let this last one ferment for a while ;) Thanks for your hard work.
The text was updated successfully, but these errors were encountered: