Error reporting for XML/HTML serializer incorrect content.

Description

What should the XML and HTML serializers do when faced with content that contradicts the corresponding specification? For example, what if an HTML5 "void element" such as <meta> (see ) actually has child data? Or what of an HTML element has both an xml:lang and a lang atribute with different values (see )?

  • We could throw an error, but the user may prefer to serialize the incorrect data.

  • We could log a warning, but this is a little inconvenient for unit tests, as we would prefer to lower the logging level or somehow turn off warnings altogether during unit tests.

  • We could ignore the problem, but that would result in data (albeit incorrect) being silently lost.

Logging a warning might be the easiest approach. A more flexible approach would be to make the serializer be configurable in this respect; if so, some reusable ignore/warn/error enum might be useful.

Environment

None

Assignee

Garret Wilson

Reporter

Garret Wilson

Labels

None

Components

Affects versions

Priority

Minor
Configure