How to replace a child node in a XML file?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mark Golberg
am 16 Jan. 2022
Beantwortet: Animesh Gupta
am 8 Feb. 2022
Hi,
I have the following XML file (assume it's file name is moose.xml):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/864490/image.jpeg)
Is there a way I can take all the content of "ModuleType Name="AlignmentCorrectionHelper" (2nd Node) and replace it with FULLY with the content of "ModuleType Name=AlarmManager" (1st node).
Important to say, that the 1st node , AlarmManager could have several layers depths inside one of it's parameters.Of course I'd like to take it all.
I saw there is a method of replaceChild here:
I'm just not so sure how to use it in my usecase.
THANKS,
Mark
0 Kommentare
Akzeptierte Antwort
Animesh Gupta
am 8 Feb. 2022
Hello Mark,
It is my understanding of the question that you want to perform a replacement operation between two different XML files.
This can be achieved using the importNode function that imports a node from one XML document to another.
You may refer the following link for more information:
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!