From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Removing XML Element Not Working

Solved!
Go to solution

I am loading in an XML file and I need to remove an element. I am using the "Remove Child" method with an invoke node but it is not working at all and throws no errors. 

 

I have access to the element that I want to remove so I get a reference to it's parent via the "Parent" property. I then use the reference to the parent with the "Remove Child" invoke node.

 

 

There is no error thrown at all. The following is the XML code and what is highlighted in red is the portion that I'm trying to remove.

 

 

So the element highlighted in red is the element that we are finding the parent of and trying to remove. It may be important to note that for debugging purposes I was looking at the XML that the element nodes had via the "Get XML" invoke node and the XML matched with what it should be. The parent node XML value was the <Control> element with the name "Test TD2" and the child was the XML highlighted in red. For some reason though, it just wont remove the XML at all. I'm not sure as to why and anything suggestions or thoughts would be greatly appreciated.

 

 

0 Kudos
Message 1 of 13
(4,849 Views)
Whether your query referring to that child is proper
----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 13
(4,824 Views)

Do you mean to make sure that the element that I'm trying to remove and the parent of that element are what I expect them to be?

0 Kudos
Message 3 of 13
(4,819 Views)
Yes to get the refrence for that child you need to provide the xpath rite ?

Whether that x path is proper?
----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 13
(4,816 Views)

Yes it is proper. Here are images showing the XML of each element.


"XML" is the parent indicator and "XML 2" is the child indicator.

 

 

0 Kudos
Message 5 of 13
(4,812 Views)
Sorry for in convenience I am using mobile to answer your questions, where I can't try to verify the actual scenario but I have used this method earlier which worked for me.

So it's better to share the xml file and labview code
If you are not getting the answer from other members till tomorrow
I will share you with actual working code by tomorrow
----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 6 of 13
(4,802 Views)

Try to share the Actual XML File You are using

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 7 of 13
(4,778 Views)

Please Refer the Attached Code snippet with sample XML File

 

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 8 of 13
(4,775 Views)

The best way to get help is to post your vi (not a picture of your code)  and your file. The issue might be somewhere else.

 

Ben64

0 Kudos
Message 9 of 13
(4,766 Views)

@ben64 wrote:

The best way to get help is to post your vi (not a picture of your code)  and your file. The issue might be somewhere else.

 

Ben64


i have attached code snippet, hope we can use snippet as actual code

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 10 of 13
(4,762 Views)