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 attribute values when appropriate, as described in sections 5.1 Element-Level Namespaces, 6.3.1 Element Names, and 6.3.3 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 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, empty elements, such as the following <img> element.

W3C

For more information, see Section 6.4 Void Elements.

Required Elements

The following table uses the required <tbody> element, as described in Section 6.1 Required Elements.

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 uses the required <colgroup> element, as described in Section 6.1 Required Elements.

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

Named Entity References

This paragraph uses the string &amp; for ampersands and uses the string &#xA0; for a nonbreaking space between the words "polyglot markup" as described in Section 8. Named Entity References.