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

Support of xml comments #22

Closed
ralemy opened this issue Aug 1, 2015 · 2 comments
Closed

Support of xml comments #22

ralemy opened this issue Aug 1, 2015 · 2 comments

Comments

@ralemy
Copy link

ralemy commented Aug 1, 2015

I am trying to use this library to keep track of version dependency of pom files. (by the way it is awesome and thank you very much for sharing it). The only problem I have is that the comments will be stripped of the original file once I use toString() to write it back to the disk.

Looking at the code I don't see the oncomment event being captured. is this by design, or is there another way to capture comments?

Regards,
Reza

@nfarina
Copy link
Owner

nfarina commented Aug 3, 2015

Hi Reza, I'd say the current behavior is "design-by-omission". xmldoc was not really intended to allow you to modify XML and write it back to disk - the toString() method is only meant for debugging. In order to support comments we'd have to introduce a new XML node type which would move this library away from the "simple XML parser" that it's meant to be.

Perhaps you could try parsing your XML using a more full-featured library like elementtree?

nfarina added a commit that referenced this issue Apr 27, 2016
Fixes #22

Also discards "extra" XML information outside the first root node, like
trailing comments or extra nodes, since we have no sensible place to
store them in our data structure.
@nfarina
Copy link
Owner

nfarina commented Apr 27, 2016

Changed my mind on this. Thanks for the request!

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

No branches or pull requests

2 participants