-
Notifications
You must be signed in to change notification settings - Fork 264
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
Parse and modify XML tag element using xmldom #116
Comments
I'm seeing the same issue, I posted a similar explanation here: http://stackoverflow.com/questions/30571674/replacing-text-in-an-xml-node-in-node-js. The problem seems to be with the XMLSerializer, I can drill down to the same nodeValue result numerous times and get the correct output, but as soon as I serialise the document the node text is reverted to the original value. |
Same problem for me :( |
Folks, it is 2019 and I am having this issue too. Any updates? If you print the node object (instead of serializing it) you get a discrepancy. In my case I am using If you print the node before changing, you have
But after changing, I notice that the
Any way to access the property and modify it too? |
A related issue with a workaround here: #33 (comment) |
Hello! It's the year 2023 and I'm experiencing the same issue. The issue does, indeed, lie in that changing the nodeValue doesn't automatically update the data value. So I decided to edit the data value as well with satisfying results: node.firstChild.nodeValue = text;
node.firstChild.data = text; |
this project has not been maintained for years, but the fork https://github.com/xmldom/xmldom which is published as Even though this issue has also not been addressed in that repo, and it's not a trivial change since it's using plain fields all over the place instead of getters, it might be worth porting the issue over there, so it can be prioritized. |
I am trying to read modify write and XML tag element value.
fs.readFile('./test.xml','utf8', function (err, data) {
if (err) {
return console.log(err);
} else {
var doc = new dom().parseFromString(data);
});
Am I missing something ?
Thanks in advance.
The text was updated successfully, but these errors were encountered: