Sample Page Using Polyglot Markup

The source code for this document uses polyglot markup, a document that is a stream of bytes that parses into identical document trees (with the exception of the xmlns attribute on the root element) when processed as HTML and when processed as XML. The source code for this document also contains additional comments about the use of polyglot markup.

Foreign Elements

The following shapes use SVG elements. Polyglot markup introduces undeclared (native) default namespaces for the the root SVG element (svg) and respects the mixed-case element names and values when appropriate, as described in the section on Element-Level Namespaces, the section on Element Names and the section on Attribute Values.

Three SVG shapes This SVG image contains an ellipse filled with a gradient that goes from white to blue as it moves outward from the center. A yellow rectangle with a black border overlaps the ellipse in the upper-left quadrant, and a red spiral on a white background overlaps the ellipse in the bottom-right quadrant. The red spiral is also a link to the example code for that SVG shape.

Void Elements

There is an empty p element before this paragraph. Polyglot markup uses <p></p> and not <p/>.

Polyglot markup treats certain elements as self-closing, void elements, such as the following img element.


For more information, see the Void Elements section.

Required Elements

The following table uses the required tbody element, as described in the Required elements and tags section.

Column One Column Two
Row 1, Column 1 Row 1, Column 2
Row 2, Column 1 Row 2, Column 2
Row 3, Column 1 Row 3, Column 2

The following table makes use of the col element and therefore uses the then required colgroup element as col element wrapper for, as described in the Required elements and tags section.

ISBN Title Price
3476896 My first HTML $53
1234567 Intermediate Polyglot $49

Named Entity References

The paragraph you now read, uses the string &amp; for ampersands (“&”) and uses, as described in the section on Named entity references, the string &#xA0; for a non-breaking space between the following two words: polyglot markup.