Skip to content

@Dtd code generation is incorrect for ordered mandatory elements #237

@raner

Description

@raner

The example DTD used for tests declares:

<!ELEMENT html (head, body)>

In other words, an html element must contain both a head and a body, in that specific order (NOTE: this used to be a requirement in HTML 4.01, but is actually no longer required in HTML5).

The generated (incorrect) code is:

 public interface HtmlContents
 {
 }
 public interface HtmlContents0 extends HtmlContents
 {
-    HeadElement<HtmlContents0> head();
 }
 public interface HtmlContents1 extends HtmlContents
 {
-    BodyElement<HtmlContents1> body();
 }

This is incorrect, and will actually not allow creation of an html element.
The correct code is:

 public interface HtmlContents
 {
 }
 public interface HtmlContents0 extends HtmlContents
 {
+    HeadElement<HtmlContents1> head();
 }
 public interface HtmlContents1 extends HtmlContents
 {
+    BodyElement<HtmlContents> body();
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions