I want to make a NULL XML file. I have come up with the following:
<?xml version="1.0" encoding="UTF-8"?>
<open>
</open>
Is this considered a NULL XML file? Or is it just an empty file with .xml extension.
CodePudding user response:
Short answer: A "NULL XML file" is neither conventional nor standard terminology but likely refers to a minimal XML document, a single empty element, in a file.
Longer explanation: Your example XML has
- an XML declaration,
- an
open
element, - a text node child of the
open
element consisting of a newline character.
An XML document, which is standard terminology, must have at least a document element – an empty file is not a well-formed XML document.
An XML parsed entity, which also is standard terminology, may minimally be an empty file.
So:
A file consisting of an empty element,
<e/>
, is a minimal XML document.An empty file is a minimal XML parsed entity.
Given that user-level tools and conversations regarding "XML files" most frequently are about files containing XML documents, someone asking for a "NULL XML file" likely wants a file containing a minimal XML document: <e/>
.
Thanks to Michael Kay for the helpful suggestion to consider XML parsed entities in addition to XML documents.