You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this is not the issue but a new request, but I feel this should be handled.
I have a below XML:
<Benchmark xmlns="http://checklists.nist.gov/xccdf/1.1" xml:lang="en-US">
<Profile id="profile1">
<title xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="en-US">text1</title>
<select idref="This is rule 1" selected="true"/>
<!--Rule:world_writable_sticky_dirs uses following values:-->
<!--Rule:world_writable_sticky_dirs uses following values:-->
<set-value idref="ssfs_master_key_timeout">20</set-value>
</Profile>
<Profile id="profile2">
<title xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="en-US">text2</title>
<select idref="this is rule1" selected="true"/>
<!--Rule:world_writable_sticky_dirs uses following values:-->
<!--Rule:world_writable_sticky_dirs uses following values:-->
<select idref="this is rule1" selected="true"/>
</Profile>
</Benchmark>
Below is my code:
var fs = require('fs');
var et = require('elementtree');
var pd = require('pretty-data').pd;
var tailorData, etree;
tailorData = fs.readFileSync('my.xml').toString();
**etree = et.parse(tailorData); // This function misses all the comments section. So while writing etree to file, comments will be gone.**
var profile = etree.find('./Profile');
profile.set('id', 'MyElementTree');
var resultXml = etree.write();
fs.writeFileSync(tailoredXML, resultXml);
Their is no handler for comments.
NPM\elementtree\lib\parsers\sax.js:
XMLParser.prototype._handleComment = function(comment) {};
Is there any way I can include comments also in et.parse(), as these comments are important in my case ??? I have seen the below file of the elementtree npm, but didn't got idea how to handle the comments section.
NPM\elementtree\lib\parsers\sax.js
NPM\elementtree\lib\treebuilder.js
The text was updated successfully, but these errors were encountered:
I know this is not the issue but a new request, but I feel this should be handled.
I have a below XML:
Their is no handler for comments.
NPM\elementtree\lib\parsers\sax.js:
XMLParser.prototype._handleComment = function(comment) {};
Is there any way I can include comments also in et.parse(), as these comments are important in my case ??? I have seen the below file of the elementtree npm, but didn't got idea how to handle the comments section.
NPM\elementtree\lib\parsers\sax.js
NPM\elementtree\lib\treebuilder.js
The text was updated successfully, but these errors were encountered: