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

Reuse the writeAttribute method in writeAttributes. #134

Merged
merged 2 commits into from Jan 22, 2023
Merged

Reuse the writeAttribute method in writeAttributes. #134

merged 2 commits into from Jan 22, 2023

Conversation

Ekryd
Copy link

@Ekryd Ekryd commented Nov 4, 2021

Hi, I'm currently using dom4j for a plugin and need to modify the output of attributes. Currently I need to override the writeAttributes method which do contain the private field namespaceStack and I need to use reflection to access the field, which is not ideal.
If writeAttributes could call the writeAttribute method this would help a lot. Then I only would need to override the smaller writeAttribute method and it does not contain any private fields.
Both methods use the same code, so it would be possible reuse the methods. The only line that stands out is that writeAttribute contains the line lastOutputNodeType = Node.ATTRIBUTE_NODE;, but I do not think that this affects the output.
Sincerely, Björn

@FilipJirsak FilipJirsak merged commit 7ee1591 into dom4j:master Jan 22, 2023
@Ekryd
Copy link
Author

Ekryd commented Jan 29, 2023

Works beautifully! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants