I am learning XML and I am trying to create a XML file for a test input. The XML file must provide a test name and a list of files to be tested. I am not sure which XML structure is better suited for this among the two:
<?xml version="1.0"?>
<test>
<name>Test987575454</name>
<file>File1.cpp</file>
<file>File2.cpp</file>
<file>File3.h</file>
</test>
or
<?xml version="1.0"?>
<test name="Test987575454">
<file>File1.cpp</file>
<file>File2.cpp</file>
<file>File3.h</file>
</test>
It depends on your requirement, i’e what type of XML parser you will use. Generally your first example is a good way to structure a XML file.