LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XML Attribute

Solved!
Go to solution

Does anyone have an example of using the LabVIEW XML Parser (not LabVIEW Schema) to create/attach an Attribute?  There doesn't appear to be an example in LV 8.6 using the Create/Get/Set Attribute methods, and I have been fiddling with it for several hours without luck.

 

 

 

Joe Gerhardstein
Viasat
Certified LabVIEW Architect
Certified TestStand Developer
Certified Professional Instructor
http://www.viasat.com
0 Kudos
Message 1 of 18
(6,932 Views)
Solution
Accepted by topic author Joe_Gerhardstein
How about the attached example?
Message 2 of 18
(6,913 Views)

Thanks...I had been trying to use the "Create Attribute" property, which oddly wouldn't throw an error but nor would it attach an attribute!

 

 

Joe

Joe Gerhardstein
Viasat
Certified LabVIEW Architect
Certified TestStand Developer
Certified Professional Instructor
http://www.viasat.com
Message 3 of 18
(6,893 Views)
You can still do it that way, but it takes extra steps.
Message 4 of 18
(6,873 Views)

Ah, I was trying to use the Append Child method to attach the Attribute.

 

Thanks again!

Joe Gerhardstein
Viasat
Certified LabVIEW Architect
Certified TestStand Developer
Certified Professional Instructor
http://www.viasat.com
0 Kudos
Message 5 of 18
(6,868 Views)

I am not able to retrieve the attribue of the config node in this example:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<config id="instrument">
 <register descr="my descr.1" adr="0" offset="0" mult="0.1" />
 <register descr="my descr.2" adr="1" offset="0" mult="0.1" />
 <register descr="my descr.3" adr="2" offset="1" mult="1.0" />
 <register descr="my descr.4" adr="200" offset="0" mult="0.1" />
 <register descr="my descr.5" adr="201" offset="0" mult="0.1" />
</config>

 

I can do that only for register node , maybe because they have not childs

Using LV8.6 xml parser functions

0 Kudos
Message 6 of 18
(6,567 Views)
How to REPLACE an attribute value in a given DOM?
0 Kudos
Message 7 of 18
(6,550 Views)
What does your code look like?
0 Kudos
Message 8 of 18
(6,549 Views)

It seems all so clunky, I am not a painter, this should be software engineering Smiley Mad

On the top of the block diagram, I am not able to use correctly the getElementByID, so it's not optimal.

NI Documentation is horrible, element and node are confusing.

Where is class documentation hierarchy?

Element IS a node, where is the OO concept applied?

I swear I redo the project in .NET from scratch if I don't manage to understand this within tomorrow.

It is a piece of crap, I am really disappointed.

I draw infinite calls where I just need 1 single line of javascript (jQuery) to do this.

All in the name of Graphical Programming? pathetic...

 

0 Kudos
Message 9 of 18
(6,538 Views)

I have no intention of getting into a debate with you on whether LabVIEW is a "real" programming language. You've already made your opinions on this matter clear. Just because you can't understand it doesn't mean it's "crap". All that I will say is the LabVIEW is a programming language and is software engineering. If you can't see that then you don't know what software engineering is.

 

As to your specific issue: Aside from not using the event structure properly**, the code you have correctly reads the attributes and populates the indicators. What is the issue?

 

** Event structure issue:

  • When you have Boolean controls that are "Latch" operations then the control's terminal needs to be placed inside the event case so that the value can be read and the control reset. Place each button in the respective event case and eliminate the constant of 100 wired to the event structure.
Message 10 of 18
(6,530 Views)