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

Added optional comment handling #504

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

visorgames
Copy link

XML-Comments can now be parsed or build.
The comments can be accessed via the commentskey (default: $comments) under their parent node.
To activate this feature, the option parseComments has to be set to true.

To support multiple comments contained in the same tag, the comments are pushed to an array like any other node. Comments are only parsed if they are at least inside the root node.
The position of comments in the xml is only reliably preserved if they are not placed in between child tags with the same name (eg.: <test>...</test><!-- comment --><test>...</test>) or are split by an other child tag (eg.: <!-- comment1 --><test/><!-- comment2 -->). Otherwise the original xml-structure can be rearranged, as nodes with the same tag-name get parsed into an array.

This feature was already requested in the past: #44, #475

@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) to 97.727% when pulling 0bdbcce on visorgames:master into 0f0a298 on Leonidas-from-XIV:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) to 97.727% when pulling 0bdbcce on visorgames:master into 0f0a298 on Leonidas-from-XIV:master.

@ainthek
Copy link

ainthek commented Apr 7, 2020

+1 when will this be available please ?

@Leonidas-from-XIV
Copy link
Owner

Leonidas-from-XIV commented Apr 7, 2020 via email

@mastakillahBlitzar
Copy link

How can we contribute to pull this through ? very helpful

@TaroXin
Copy link

TaroXin commented Mar 23, 2021

@Mask

How can we contribute to pull this through ? very helpful

I found a library that is better adapted and also supports comments parsing, https://github.com/oozcitak/xmlbuilder2

I have seen the information you left from many libraries, I believe you are also very anxious

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.

6 participants