Jump to content

Manual:$wgWellFormedXml

From mediawiki.org
Output: $wgWellFormedXml
Whether to try to make our HTML output well-formed XML.
Introduced in version:1.16.0 (r54767)
Removed in version:1.27.0 (Gerrit change 286495; git #ee4d5c6e)
Allowed values:(boolean)
Default value:true

Details

Whether to try to make our HTML output well-formed XML even if $wgHtml5 is true.

If set to false, output will be a few bytes shorter, and the HTML will arguably be more readable. If set to true, life will be much easier for the authors of screen-scraping bots, and the HTML will arguably be more readable.

Setting this to false may omit quotation marks on some attributes, omit slashes from some self-closing tags, omit some ending tags, etc., where permitted by HTML5. Setting it to true will not guarantee that all pages will be well-formed, although non-well-formed pages should be rare and you should report them as a bug if you find one. Conversely, setting it to false doesn't mean that all XML-y constructs will be omitted, just that they might be.

Because of compatibility with screen-scraping bots, and because it's controversial, this is currently left to true by default.

In version 1.16.0, this implies the doctype is changed to XHTML 1.0 Strict to make named character references work in XML. From version 1.17, named character references are avoided.

After its removal in MediaWiki 1.27, the previous default mode $wgWellFormedXml = true; is what MediaWiki will use in the future.

The removal of $wgWellFormedXml was backported to 1.23.15 and 1.26.4.