I'm writing a boolean that will toggle between these two forms for writing markup into my strings, but I do not know what I should name my boolean.

bool setMarkupForm(bool markupForm); 

Is not obvious enough to me to tell me what it is doing. What terms are used to differentiate between:





  • 3
    Duplicate of stackoverflow.com/questions/3741896/… – Michael Kay Oct 14 '16 at 10:32
  • 1
    Unless you know this and this inside and out, you should not be writing something that generates XML "strings." For the sake of those people who have to consume what you produce, please use a serializer written by someone who does know the specs. – kdgregory Oct 14 '16 at 11:17

In Extensible Markup Language (XML) 1.1 (Second Edition) Section 3.1 Start-Tags, End-Tags, and Empty-Element Tags, it's called an "empty-element tag". If you were using XML and needed the formal term, this is the one that I'd use.

However, other markup languages do use other terms for the same concept.

In XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition) Appendix C HTML Compatibility Guidelines Section C.2 (and later sections), it is called the "minimized tag syntax".

In HTML: The Markup Language (an HTML language reference) Section 4.3 Elements, they are referred to as "void elements".

I've also heard the term "self-closing tag" used. This term is also used in HTML5 A vocabulary and associated APIs for HTML and XHTML Section Self-closing start tag state along with many other sources.

Any of these other terms may be used by someone who is coming from a different background and may not know the term as it's defined in the specification and formal documentations for your particular language.

Mark Byers answer on Stack Overflow to a similar question provides more information about these terms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.