LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

cvixml and empty element

In xml an empty element can be indicated in two ways:

  • <element_name></element_name>
  • <element_name/> (using an empty tag)

Is there a way to get the empty tag using cvixml library?

I'm only able to get <element_name></element_name>

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 4
(4,624 Views)

Hi Vix,

 

Can you provide more details about what functions in the XML API you are using, and what values you expect?  

 

Have you tried using the XML shipping example, located in <samples>\toolbox\XMLSample.cws?  You'll notice that it reads an XML file, and finds XML elements even if they are self-closing.  You can select a self-closing element from the list view in the example, select View Child Element and then select View Element Attributes to view properties of that element.

 

For example, if my XML file contained the following:

<?xml version="1.0"?>
<catalog>

   <book name="Timequake" author="Kurt Vonnegut"/>

</catalog>

 

I would see the following in the example:

XML Example1.PNG

 

and:

XML Example2.PNG

 

Is there something different you were trying to extract from the XML?

 

Thanks,
Daniel

 

 

Daniel Dorroh
National Instruments
0 Kudos
Message 2 of 4
(4,578 Views)

Hi Daniel,

sorry but I wrote my question awfully Smiley Embarassed and so you can't understand what I meant.

 

I want to write and xml file (not read), and I want to write empty elements as <element_name/>

Using CVIXMLNewElement() the empty tag is written as <element_name></element_name>

 

Is there a way to write empty elements as <element_name/>?

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 4
(4,566 Views)

Hello vix!

 

As Daniel mention in his reply, the <samples>\toolbox\XMLSample.cws illustrates how one can write empty self-closing XML tags to a file. Run the mentioned sample project and insert an empty element into the XML document and then save it to disk. Open the XML file from disk and notice that the empty element is written as a self-closed XML tag. How are you saving the XML document to disk?

 

Best regards!

0 Kudos
Message 4 of 4
(4,542 Views)