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

Ensure XML.attributes(node) === nothing when node has no attributes #34

Closed
wants to merge 2 commits into from

Conversation

TimG1964
Copy link
Contributor

@TimG1964 TimG1964 commented Feb 12, 2025

Speculative suggestion to fix issue #33 - proposed for review.
Tests pass locally but I think this needs deeper understanding than I can bring.
I have focused only on XML.Elements.

Speculative suggestion.
Tests pass locally but I think this needs deeper understanding than I can bring.
Change `setindex!()` to deal with case when `XML.attributes(node) === nothing`
@TimG1964
Copy link
Contributor Author

I added another change to setindex() to deal with the case when XML.attributes === nothing

@TimG1964
Copy link
Contributor Author

I think I'm going to need more help here.

What I really want to do around line 208 is

    o.attributes = isnothing(o.attributes) ? OrderedDict{String, String}() : o.attributes

Except, of course, a node is immutable, so this doesn't work.

What I've suggested in my last change doesn't work because it simply assigns o to a new Node and so it no longer updates the original node o in place.

I think I can make the change from nothing to OrderedDict in my code before the call to setindex!(), but that isn't really a solution, is it?.

Help!

@TimG1964 TimG1964 closed this Mar 11, 2025
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

Successfully merging this pull request may close these issues.

1 participant