-
-
Notifications
You must be signed in to change notification settings - Fork 322
Support a new option "stopNodes". #150
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 a new option "stopNodes". #150
Conversation
This field is an array with 0 or more tagnames. When it encounters a tagname that matches the list of stopNodes, it will treat all the stuff understand this tag as a string. This is useful when parsing xml, a part of it is considered as xhtml.
What if different tags are having the nested tag with the same name? It'll
be applicable on all. And what's about the tag inside CDATA.
Have you checked the applications where it can be used? I mean, since it is
gonna impact the performance of the application, it should be implemented
only if it is required by multiple projects.
On 12 Mar 2019 3:22 am, "jinq102030" <notifications@github.com> wrote:
This field is an array with 0 or more tagnames. When it encounters a
tagname that matches the list of stopNodes, it will treat all the stuff
understand this tag as a string.
Purpose / Goal
This is used to support the parsing of certain xml documents where some
nodes, such as contains a xhtml structure. We need to treat it as a string
and pass it to calling entity.
------------------------------
You can view, comment on, or merge this pull request online at:
#150
Commit Summary
- Support a new option "stopNodes".
File Changes
- *M* src/xmlstr2xmlnode.js
<https://github.com/NaturalIntelligence/fast-xml-parser/pull/150/files#diff-0>
(11)
Patch Links:
- https://github.com/NaturalIntelligence/fast-xml-parser/pull/150.patch
- https://github.com/NaturalIntelligence/fast-xml-parser/pull/150.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#150>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AiuBatkHuuvQizgyFeH3aXgUlkBGrD_Pks5vVtAugaJpZM4bpo2i>
.
|
Hi TheDeathConqueror,
You reminded me that I probably need to highlight some of these in README. Thanks! |
Thanks for your PR. Can you please add unit tests for following cases?
I'm just wondering what should happen when we convert back to XML. In my understanding, we'll get the same XML. |
Sorry for the late response. Thanks for the good tests.
Should I just run the test them in my local environment or add some tests along with the PR? Thanks. |
Yes, we need to add the tests along with PR, to ensure that nothing is broken any future changes. |
Tried to run the
|
The tests are written in jasmine. You can find that in package.json. You can run them by |
Thanks Amit for your suggestion. Added the tests spec/stopNodes_spec.js. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add 2 more tests
}); | ||
|
||
it("1b. 3. should support more than one stopNodes, with or without attr", function() { | ||
const xmlData = `<issue><title>test 1</title><fix1 lang="en"><p>p 1</p><div class="show">div 1</div></fix1><fix2><p>p 2</p><div class="show">div 2</div></fix2></issue>`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write a test when fix2 is inside fix1. In this case, fix2 should be empty in the result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks for the suggestion.
}); | ||
|
||
it("2. stop node has nothing in it", function() { | ||
const xmlData = `<issue><title>test 1</title><fix1></fix1></issue>`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test when fix1 is a self closing tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks for the suggestion.
Hi Amit, thanks for the review comments, they are implemented. Could you check? Thanks. |
Thanks for the changes. Everything looks perfect. I'll approve the changes soon. However, it may take some time to publish. |
Thanks Amit! |
This field is an array with 0 or more tagnames. When it encounters a tagname that matches the list of stopNodes, it will treat all the stuff understand this tag as a string.
Purpose / Goal
This is used to support the parsing of certain xml documents where some nodes, such as contains a xhtml structure. We need to treat it as a string and pass it to calling entity.