11-18-2013 04:11 AM
In xml an empty element can be indicated in two ways:
Is there a way to get the empty tag using cvixml library?
I'm only able to get <element_name></element_name>
11-27-2013 03:05 PM
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:
and:
Is there something different you were trying to extract from the XML?
Thanks,
Daniel
11-28-2013 01:07 AM
Hi Daniel,
sorry but I wrote my question awfully
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/>?
12-02-2013 05:38 AM - edited 12-02-2013 05:49 AM
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!