Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty XML Element tag issue #5

Open
pbrooks100 opened this issue Oct 25, 2018 · 1 comment
Open

Empty XML Element tag issue #5

pbrooks100 opened this issue Oct 25, 2018 · 1 comment

Comments

@pbrooks100
Copy link

pbrooks100 commented Oct 25, 2018

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.

@JKSH
Copy link

JKSH commented Oct 30, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants