LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XML Attribute

Solved!
Go to solution

After loading and populating, I want the save button make the reverse operation.

That is, take the control values (that could have been changed by the user), and save them in the same XML file.

I have a problem for the operation of "find & change an attribute of an element", I'm stuck in the property/invoke nodes

0 Kudos
Message 11 of 18
(2,182 Views)

The array that you have on the front panel is actually an indicator, not a control, so a user would not be able to edit the values while the VI is running. Once you change it to a control you will need to use a local variable to write to it in the "Load" event case. In the "Save" event case you would use the control's terminal to get the new values.

 

Since you are providing the array on the front panel a user would have the ability to add/delete "register" nodes via the right-click menu. Thus, the easiest thing to do is to simply recreate the new tree based on the new data rather than figuring out which nodes got deleted and which nodes got changed. If you open the Example Finder and search for "XML" you can take a look at the "Write Test Data File" example. It shows you how to write out a new XML file. Your code would not nearly be as wide since your XML structure is fairly simple.

 

If you do not want the user to be able to add/delete nodes then you must do at least 2 things:

  • Hide the index display on the array. This will prevent a user from scrolling to, say, a 5th element and adding new data.
  • Disable the right-click menu. This can be done in a variety of ways. Here's 2:
    • Provide your own popup menu
    • Respond to the "Shortcut Menu Activation?" event and wire a True to the "Discard" output for any menu choices that you do not want the user to be able to do. 
0 Kudos
Message 12 of 18
(2,174 Views)
In the example we can see that the WriteXML does not automatically insert carriage returns (and possibily tabs proportional to the nested level, but I guess this is something for Mr.Spock technology only). Is it fair? I get a single line XML file.
0 Kudos
Message 13 of 18
(2,161 Views)
ok, carriage return, tabs and attirbute ordering are not part of XML standard. I'm trying to add extra coding
0 Kudos
Message 14 of 18
(2,154 Views)
You could try using xmllint from the libxml library. Or, you could use a stylesheet as the attached VI does (which uses LabXML).
0 Kudos
Message 15 of 18
(2,146 Views)

Hello,

 

I would like to know how to extract xml node attributes without knowing the names of those attributes. Is it possible using the XML parser of labvew 2010? 

 

For example say I am reading in the below xml structure:

 

<node_1>

 <node_2 name = second_node> text </node_2>

 <node_3 type = a> 

<node_4> text </node_4>

 </node_3>

</node_1>

 

The programmer has no knowledge of the xml structure or content when writing. How do I extract the attributes of each node?

 

Thank you,

labjunky

 

0 Kudos
Message 16 of 18
(1,722 Views)

Hello,

 

Would you mind statring a new thread with your question?  This will increase the possibility that others will respond since this thread is so old.  Thanks!

 

-Cody C

0 Kudos
Message 17 of 18
(1,687 Views)

Hi,

I have used an example for XML parsing for LV2009. Now I would like to use it for LV 8.x. I realized that all the Vis were properly recognized but one, the picture shows which one. Is there an example program that does the same (parsing the Attributes of an XML file and returning its Attribute value)?

 

Thanks for any hints

Y3G


 

0 Kudos
Message 18 of 18
(1,539 Views)