JKI-EasyXML
JKI-EasyXML copied to clipboard
Empty XML Element tag issue
I'm using JKI-EasyXML to write test results for a third party. They claim that the empty elements contained in the file are not compliant; the element tag should have a space between the name and the forward slash. Their parser rejects the JKI-EasyXML output.
https://www.w3schools.com/xml/xml_elements.asp
There are two ways to indicate an empty element;
<element></element>
or <element />
Example of JKI-EasyXML output:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<TESTRESULTS>
<MODEL>UNKNOWN</MODEL>
<PC>Station 1</PC>
<SERIALNUMBER>BR549</SERIALNUMBER>
<PN/>
<MAC>00:11:22:33:44:55</MAC>
<HWID/>
<R/>
<PASSFAIL>P</PASSFAIL>
<FAILCODE/>
</TESTRESULTS>
Expected XML:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<TESTRESULTS>
<MODEL>UNKNOWN</MODEL>
<PC>Station 1</PC>
<SERIALNUMBER>BR549</SERIALNUMBER>
<PN />
<MAC>00:11:22:33:44:55</MAC>
<HWID />
<R />
<PASSFAIL>P</PASSFAIL>
<FAILCODE />
</TESTRESULTS>
I've narrowed the issue down to
'JKI_EasyXML.llb\XML Build Entity__JKI EasyXML.vi'
but due to the recursive design of the calling VI
'JKI_EasyXML.llb\Variant to XML - core - __JKI EasyXML.vi'
I am hesitant to make any quick changes.
They claim that the empty elements contained in the file are not compliant; the element tag should have a space between the name and the forward slash.
No, the space before the slash is optional in XML. See the official spec: https://www.w3.org/TR/xml/#dt-empty.
The third-party parser is the non-compliant one here.
Example of JKI-EasyXML output:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <TESTRESULTS> <MODEL>UNKNOWN</MODEL> <PC>Station 1</PC> <SERIALNUMBER>BR549</SERIALNUMBER> <PN/> <MAC>00:11:22:33:44:55</MAC> <HWID/> <R/> <PASSFAIL>P</PASSFAIL> <FAILCODE/> </TESTRESULTS>
The W3C validator accepts this as well-formed XML: http://validator.w3.org/#validate_by_input