mojohaus / xml-maven-plugin

XML Maven Plugin
https://www.mojohaus.org/xml-maven-plugin/
Apache License 2.0
22 stars 21 forks source link

xml:check-format produces false-positives in some mixed-content scenarios #53

Open sewe opened 4 years ago

sewe commented 4 years ago

When checking (X)HTML documents for correct indentation, I run into some strange false-positives.

The following minimal (X)HTML document is the result of some systematic exploration on my part. It should explain where I see the false-positives, namely in certain cases of mixed content (as is used when HTML inline elements like <em> are involved):

<html>
  <head>
    <title>Example</title>
  </head>
  <body>
    <p>This validates.</p>
    <p>This does, <em>too.</em></p>
    <p>Paragraphs with multiple lines also validate:
      Like this.</p>
    <p>They even validate when inline elements are involved.
      Like <em>here.</em>
      Nice, isn't it?</p>
    <p>But we hit a bug if the inline elements covers the whole line.
      <em>Like here.</em></p>
    <p>Or if more text follows the inline element:
      <em>Like in the next line.</em>
      See?</p>
    <p>But placing the closing paragraph tag on a different line is (whitespace-wise) different:
      <em>This "workaround" will bite you when using p::after in CSS.</em>
    </p>
  </body>
</html>
jochenw commented 4 years ago

On Fri, Nov 1, 2019 at 11:35 AM Andreas Sewe notifications@github.com wrote:

When checking (X)HTML documents for correct indentation, I run into some strange false-positives.

The following minimal (X)HTML document is the result of some systematic exploration on my part. It should explain where I see the false-positives, namely in certain cases of mixed content (as is used when HTML inline elements like are involved):

Example

This validates.

This does, too.

Paragraphs with multiple lines also validate: Like this.

They even validate when inline elements are involved. Like here. Nice, isn't it?

But we hit a bug if the inline elements covers the whole line. Like here.

Or if more text follows the inline element: Like in the next line. See?

But placing the closing paragraph tag on a different line is (whitespace-wise) different: This "workaround" will bite you when using p::after in CSS.

What schema are you using?

Jochen

sewe commented 4 years ago

No schema. In fact, XHTML5 doesn't have one.

But AFAIK, xml:check-format just requires well-formedness, not validity, so the schema should be immaterial.

jochenw commented 4 years ago

On Mon, Dec 2, 2019 at 10:53 AM Andreas Sewe notifications@github.com wrote:

No schema. In fact, XHTML5 doesn't have one.

But AFAIK, xml:check-format just requires well-formedness, not validity, so the schema should be immaterial.

Okay, understood. But then, what false positives are being reported? (A reproducible fake project would be appreciated.)

Jochen