<!-- Add the following to any file that is to be validated against this DTD:

<!DOCTYPE import-control PUBLIC
    "-//Checkstyle//DTD ImportControl Configuration 1.5//EN"
    "https://checkstyle.org/dtds/import_control_1_5.dtd">
-->

<!--
  The root element of the configuration file.
-->
<!ELEMENT import-control ((allow|disallow)*,(subpackage|file)*)>

<!--
  pkg - The root package to be checked. For example "com.puppycrawl".

  regex - Root package name has to be interpreted as
  regular expression.

  strategyOnMismatch - Strategy in a case if matching allow/disallow rule
  was not found. Possible values: allowed, disallowed.
  If not defined explicitly, has "disallowed" value by default.
-->
<!ATTLIST import-control
  pkg CDATA #REQUIRED
  strategyOnMismatch (allowed|disallowed) #IMPLIED
  regex (true) #IMPLIED>

<!--
  Represents a subpackage of the parent element.
-->
<!ELEMENT subpackage ((allow|disallow)*,(subpackage|file)*)>

<!--
  name - The name of the subpackage. For example if the name is "tools"
  and the parent is "com.puppycrawl", then it corresponds to the
  package "com.puppycrawl.tools". If the regex attribute is "true" the
  name is interpreted as a regular expression.

  regex - Subpackage name has to be interpreted as
  regular expression.

  strategyOnMismatch - Strategy in a case if matching allow/disallow rule
  was not found. Possible values: allowed, disallowed, delegateToParent.
  If not defined explicitly, has "delegateToParent" value by default.
-->
<!ATTLIST subpackage
  name CDATA #REQUIRED
  strategyOnMismatch (delegateToParent|allowed|disallowed) #IMPLIED
  regex (true) #IMPLIED>

<!--
  Represents a file of the parent element.
-->
<!ELEMENT file (allow|disallow)*>

<!--
  name - The name of the file.
  If the regex attribute is "true" the name is interpreted as a regular expression.

  regex - File name has to be interpreted as regular expression.
-->
<!ATTLIST file
  name CDATA #REQUIRED
  regex (true) #IMPLIED>

<!--
  Represents attributes for an import rule which can either allow or
  disallow access.

  pkg - The fully qualified name of the package to allow/disallow.
  Cannot be specified in conjunction with "class" or "module".

  class - The fully qualified name of the class to allow/disallow.
  Cannot be specified in conjunction with "pkg" or "module".

  module - The fully qualified name of the module to allow/disallow.
  Cannot be specified in conjunction with "pkg" or "class".

  exact-match - Only valid with "pkg". Specifies whether the package
  name matching should be exact. For example, the pkg
  "com.puppycrawl.tools" will match the import
  "com.puppycrawl.tools.checkstyle.api.*" when the option is not set,
  but will not match if the option is set.

  local-only - Indicates that the rule is to apply only to the current
  package and not to subpackages.

  regex - Indicates that the class, package, or module name has to be interpreted as
  regular expression.
-->
<!ENTITY % attlist.importrule "
  pkg CDATA #IMPLIED
  exact-match (true) #IMPLIED
  class CDATA #IMPLIED
  module CDATA #IMPLIED
  local-only (true) #IMPLIED
  regex (true) #IMPLIED">

<!--
  Represents an import rule that will allow access.
-->
<!ELEMENT allow EMPTY>
<!ATTLIST allow
  %attlist.importrule;>

<!--
  Represents an import rule that will disallow access.
-->
<!ELEMENT disallow EMPTY>
<!ATTLIST disallow
  %attlist.importrule;>
