package de.codescape.bitvunit.rule.page;

import de.codescape.bitvunit.model.Page;
import de.codescape.bitvunit.rule.AbstractRule;
import de.codescape.bitvunit.rule.Violations;
import org.w3c.dom.DocumentType;

/**
 * DoctypeForPageRule ensures that every page includes a <code>&lt;!DOCTYPE /&gt;</code> element to support rendering
 * and validation of this page by browsers and other viewers or interpreters.
 *
 * @author Stefan Glase
 * @since 0.10
 */
public class DoctypeForPageRule extends AbstractRule {

    private static final String RULE_NAME = "DoctypeForPage";
    private static final String RULE_MESSAGE = "Every page must include a DOCTYPE declaration to support rendering and validation.";

    @Override
    public String getName() {
        return RULE_NAME;
    }

    @Override
    protected void applyTo(Page page, Violations violations) {
        DocumentType doctype = page.getDoctype();
        if (doctype == null) {
            violations.add(createViolation(null, page, RULE_MESSAGE));
        }
    }

}

@@ -173,41 +173,8 @@
 ons;
-%0Aimport org.w3c.dom.DocumentType;
 %0A%0A/*
@@ -371,16 +371,167 @@
 reters.%0A
+ * %3Cp/%3E%0A * Known issue: Instances of WebDriver do not know about the DOCTYPE of the original document. So this rule cannot be%0A * applied successfully.%0A
  *%0A * @a
@@ -986,69 +986,29 @@
     
-DocumentType doctype = page.getDoctype();%0A        if (doctype
+if (page.getDoctype()
  == 

add known issue and refactor code