Chris Proctor wrote:
> I have a question regarding the use of empty-element tags. I have an XML
> document that contains some elements that at times may be empty. I was
> reading that it's illegal in XML to use start/end tags with empty elements.
> Is this true and if so, I assume that I can alternate between start/end tag
> and empty-element tags, correct? I am pretty new to XML and I'd appreciate
> any input that would help me to produce good, well structured files.
You have received some very good advice about how to represent occurrences of
elements with and without data, but there is another factor that may help you
produce "good, well structured files". You may want to consider if the element
need exist at all, if it has no contents (or attributes). If you can, make the
element optional in the structure - it's much tidier than leaving in tags that
don't contribute meaningfully to the structure of the document.
Marcus Carr email: [log in to unmask]
Allette Systems (Australia) www: http://www.allette.com.au
"Everything should be made as simple as possible, but not simpler."