# WebExplorer1.1

#======= ELEMENTS =======
$emptyTags = 'BASE|BR|FRAME|HR|IMAGE|IMG|INPUT|ISINDEX|P|TAB';
$pairTags = 'A|ADDRESS|ANIMATE|B|BASEFONT|BLOCKQUOTE|BODY|CAPTION|CENTER|CITE'.
            '|CODE|DD|DIR|DL|DT|EM|FONT|FORM|H1|H2|H3|H4|H5|H6|H7|HEAD|HTML|I'.
            '|LI|LISTING|MENU|OL|OPTION|PLAINTEXT|PRE|Q|QUOTE|S|SELECT|STRONG'.
            '|TABLE|TD|TEXTAREA|TH|TITLE|TR|TT|U|UL|XMP';
$deprecatedTags = '';
$omitStartTags = 'BODY|HEAD|HTML';
$omitEndTags = 'BASEFONT|BODY|DD|DT|HEAD|HTML|LI|OPTION|PLAINTEXT|TD|TH|TR';
#$maybeEmpty = 'A|ADDRESS|B|BASEFONT|BLOCKQUOTE|BODY|CAPTION|CENTER|CITE|CODE'.
#              '|DD|DT|EM|FONT|FORM|H1|H2|H3|H4|H5|H6|H7|I|LI|LISTING|OPTION'.
#              '|PLAINTEXT|PRE|Q|QUOTE|S|STRONG|TD|TEXTAREA|TH|TITLE|TR|TT|U'.
#              '|XMP';
$maybeEmpty = 'LISTING|PLAINTEXT|PRE|TD|TEXTAREA|TH|XMP';
%requiredTags = (
  'HEAD'  => 'TITLE',
  'HTML'  => 'HEAD|BODY',
  'TABLE' => 'TR',
);
%onceonlyTags = (
  'HEAD'  => 'TITLE|ISINDEX|BASE',
  'HTML'  => 'HEAD|BODY|PLAINTEXT',
  'TABLE' => 'CAPTION',
);
$sequencialTags = 'TABLE|HTML';
%tagsElements = (
  'A'          => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|#PCDATA|H7|H6|H5|H4|H3|H2|H1',
  'ADDRESS'    => 'P|BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'ANIMATE'    => 'FRAME',
  'B'          => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'BASEFONT'   => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'BLOCKQUOTE' => 'ADDRESS|HR|ISINDEX|FORM|BLOCKQUOTE|LISTING|XMP|PRE|TABLE'.
                  '|CENTER|DL|MENU|DIR|OL|UL|P|BASEFONT|FONT|U|S|I|B|TT|QUOTE'.
                  '|Q|CITE|CODE|STRONG|EM|BR|IMAGE|IMG|ANIMATE|A|#PCDATA|H7'.
                  '|H6|H5|H4|H3|H2|H1',
  'BODY'       => 'ADDRESS|HR|ISINDEX|FORM|BLOCKQUOTE|LISTING|XMP|PRE|TABLE'.
                  '|CENTER|DL|MENU|DIR|OL|UL|P|BASEFONT|FONT|U|S|I|B|TT|QUOTE'.
                  '|Q|CITE|CODE|STRONG|EM|BR|IMAGE|IMG|ANIMATE|A|#PCDATA|H7'.
                  '|H6|H5|H4|H3|H2|H1',
  'CAPTION'    => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'CENTER'     => 'ADDRESS|HR|ISINDEX|FORM|BLOCKQUOTE|LISTING|XMP|PRE|TABLE'.
                  '|CENTER|DL|MENU|DIR|OL|UL|P|BASEFONT|FONT|U|S|I|B|TT|QUOTE'.
                  '|Q|CITE|CODE|STRONG|EM|BR|IMAGE|IMG|ANIMATE|A|#PCDATA|H7'.
                  '|H6|H5|H4|H3|H2|H1',
  'CITE'       => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'CODE'       => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'DD'         => 'ISINDEX|FORM|BLOCKQUOTE|LISTING|XMP|PRE|TABLE|CENTER|DL'.
                  '|MENU|DIR|OL|UL|P|BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE'.
                  '|CODE|STRONG|EM|BR|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'DIR'        => 'LI',
  'DL'         => 'DD|DT',
  'DT'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'EM'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'FONT'       => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'FORM'       => 'ADDRESS|HR|ISINDEX|BLOCKQUOTE|LISTING|XMP|PRE|TABLE|CENTER'.
                  '|DL|MENU|DIR|OL|UL|P|BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE'.
                  '|CODE|STRONG|EM|BR|IMAGE|IMG|ANIMATE|A|#PCDATA|H7|H6|H5|H4'.
                  '|H3|H2|H1|INPUT|SELECT|TEXTAREA',
  'H1'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'H2'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'H3'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'H4'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'H5'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'H6'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'H7'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'HEAD'       => 'TITLE|ISINDEX|BASE',
  'HTML'       => 'HEAD|BODY|PLAINTEXT',
  'I'          => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'LI'         => 'ISINDEX|FORM|BLOCKQUOTE|LISTING|XMP|PRE|TABLE|CENTER|DL'.
                  '|MENU|DIR|OL|UL|P|BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE'.
                  '|CODE|STRONG|EM|BR|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'LISTING'    => '%literal',
  'MENU'       => 'LI',
  'OL'         => 'LI',
  'OPTION'     => '#PCDATA',
  'PLAINTEXT'  => '%literal',
  'PRE'        => 'TAB|QUOTE|Q|CITE|CODE|STRONG|EM|U|S|I|B|TT|BR|HR|A|#PCDATA',
  'Q'          => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'QUOTE'      => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'S'          => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'SELECT'     => 'OPTION',
  'STRONG'     => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'TABLE'      => 'CAPTION|TR',
  'TD'         => 'ADDRESS|HR|ISINDEX|FORM|BLOCKQUOTE|LISTING|XMP|PRE|TABLE'.
                  '|CENTER|DL|MENU|DIR|OL|UL|P|BASEFONT|FONT|U|S|I|B|TT|QUOTE'.
                  '|Q|CITE|CODE|STRONG|EM|BR|IMAGE|IMG|ANIMATE|A|#PCDATA|H7'.
                  '|H6|H5|H4|H3|H2|H1',
  'TEXTAREA'   => '#PCDATA',
  'TH'         => 'ADDRESS|HR|ISINDEX|FORM|BLOCKQUOTE|LISTING|XMP|PRE|TABLE'.
                  '|CENTER|DL|MENU|DIR|OL|UL|P|BASEFONT|FONT|U|S|I|B|TT|QUOTE'.
                  '|Q|CITE|CODE|STRONG|EM|BR|IMAGE|IMG|ANIMATE|A|#PCDATA|H7'.
                  '|H6|H5|H4|H3|H2|H1',
  'TITLE'      => '#PCDATA',
  'TR'         => 'TD|TH',
  'TT'         => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'U'          => 'BASEFONT|FONT|U|S|I|B|TT|QUOTE|Q|CITE|CODE|STRONG|EM|BR'.
                  '|IMAGE|IMG|ANIMATE|A|#PCDATA',
  'UL'         => 'LI',
  'XMP'        => '%literal',
);
%excludedElems = (
  'A'        => 'A',
  'DIR'      => 'P|UL|OL|DIR|MENU|DL|CENTER|TABLE|PRE|XMP|LISTING|BLOCKQUOTE'.
                '|FORM|ISINDEX',
  'FORM'     => 'FORM',
  'MENU'     => 'P|UL|OL|DIR|MENU|DL|CENTER|TABLE|PRE|XMP|LISTING|BLOCKQUOTE'.
                '|FORM|ISINDEX',
  'SELECT'   => 'INPUT|SELECT|TEXTAREA',
  'TEXTAREA' => 'INPUT|SELECT|TEXTAREA',
);
%includedElems = (
  'FORM' => 'INPUT|SELECT|TEXTAREA',
);
#======= ATTRIBUTES =======
%tagsAttributes = (
  'A' => {
    'HREF'  => '%URL',
    'NAME'  => 'CDATA',
    'TITLE' => 'CDATA',
  },
  'BASE' => {
    'HREF' => '%URL',
  },
  'BASEFONT' => {
    'SIZE' => '%fsize',
  },
  'BODY' => {
    'ALINK'      => '%color',
    'BACKGROUND' => '%URL',
    'BGCOLOR'    => '%color',
    'LINK'       => '%color',
    'TEXT'       => '%color',
    'VLINK'      => '%color',
  },
  'CAPTION' => {
    'ALIGN' => 'TOP|BOTTOM',
  },
  'DL' => {
    'COMPACT' => 'COMPACT',
  },
  'FONT' => {
    'SIZE' => '%rsize',
  },
  'FORM' => {
    'ACTION'  => 'CDATA',
    'ENCTYPE' => '%Content-Type',
    'METHOD'  => 'GET|POST',
  },
  'FRAME' => {
    'SRC' => '%URL',
  },
  'HR' => {
    'ALIGN' => 'LEFT|RIGHT|CENTER',
    'SIZE'  => '%Pixels',
    'WIDTH' => '%Length',
  },
  'IMAGE' => {
    'ALIGN'  => 'TOP|MIDDLE|BOTTOM',
    'ALT'    => 'CDATA',
    'HSPACE' => '%Pixels',
    'ISMAP'  => 'ISMAP',
    'SRC'    => '%URL',
    'VSPACE' => '%Pixels',
  },
  'IMG' => {
    'ALIGN'  => 'TOP|MIDDLE|BOTTOM',
    'ALT'    => 'CDATA',
    'HSPACE' => '%Pixels',
    'ISMAP'  => 'ISMAP',
    'SRC'    => '%URL',
    'VSPACE' => '%Pixels',
  },
  'INPUT' => {
    'ALIGN'     => 'TOP|MIDDLE|BOTTOM',
    'CHECKED'   => 'CHECKED',
    'MAXLENGTH' => 'NUMBER',
    'NAME'      => 'CDATA',
    'SIZE'      => 'CDATA',
    'SRC'       => '%URL',
    'TYPE'      => 'TEXT|PASSWORD|CHECKBOX|RADIO|SUBMIT|RESET|IMAGE|HIDDEN',
    'VALUE'     => 'CDATA',
  },
  'OPTION' => {
    'SELECTED' => 'SELECTED',
    'VALUE'    => 'CDATA',
  },
  'PRE' => {
    'WIDTH' => 'NUMBER',
  },
  'SELECT' => {
    'MULTIPLE' => 'MULTIPLE',
    'NAME'     => 'CDATA',
    'SIZE'     => 'NUMBER',
  },
  'TAB' => {
    'ID' => 'CDATA',
    'TO' => 'CDATA',
  },
  'TABLE' => {
    'BORDER'      => '%border',
    'CELLPADDING' => '%Pixels',
    'CELLSPACING' => '%Pixels',
  },
  'TD' => {
    'ALIGN'   => 'LEFT|CENTER|RIGHT',
    'COLSPAN' => 'NUMBER',
    'NOWRAP'  => 'NOWRAP',
    'ROWSPAN' => 'NUMBER',
    'VALIGN'  => 'TOP|MIDDLE|BOTTOM',
  },
  'TEXTAREA' => {
    'COLS' => 'NUMBER',
    'NAME' => 'CDATA',
    'ROWS' => 'NUMBER',
  },
  'TH' => {
    'ALIGN'   => 'LEFT|CENTER|RIGHT',
    'COLSPAN' => 'NUMBER',
    'NOWRAP'  => 'NOWRAP',
    'ROWSPAN' => 'NUMBER',
    'VALIGN'  => 'TOP|MIDDLE|BOTTOM',
  },
);
%requiredAttrs = (
  'BASE'     => 'HREF',
  'IMAGE'    => 'SRC',
  'IMG'      => 'SRC',
  'SELECT'   => 'NAME',
  'TEXTAREA' => 'NAME&ROWS&COLS',
);
#======= ENTITIES =======
%refEntities = (
  'AElig'  => '&#198;',
  'Aacute' => '&#193;',
  'Acirc'  => '&#194;',
  'Agrave' => '&#192;',
  'Aring'  => '&#197;',
  'Atilde' => '&#195;',
  'Auml'   => '&#196;',
  'Ccedil' => '&#199;',
  'ETH'    => '&#208;',
  'Eacute' => '&#201;',
  'Ecirc'  => '&#202;',
  'Egrave' => '&#200;',
  'Euml'   => '&#203;',
  'Iacute' => '&#205;',
  'Icirc'  => '&#206;',
  'Igrave' => '&#204;',
  'Iuml'   => '&#207;',
  'Ntilde' => '&#209;',
  'Oacute' => '&#211;',
  'Ocirc'  => '&#212;',
  'Ograve' => '&#210;',
  'Oslash' => '&#216;',
  'Otilde' => '&#213;',
  'Ouml'   => '&#214;',
  'THORN'  => '&#222;',
  'Uacute' => '&#218;',
  'Ucirc'  => '&#219;',
  'Ugrave' => '&#217;',
  'Uuml'   => '&#220;',
  'Yacute' => '&#221;',
  'aacute' => '&#225;',
  'acirc'  => '&#226;',
  'acute'  => '&#180;',
  'aelig'  => '&#230;',
  'agrave' => '&#224;',
  'amp'    => '&#38;',
  'aring'  => '&#229;',
  'atilde' => '&#227;',
  'auml'   => '&#228;',
  'brvbar' => '&#166;',
  'ccedil' => '&#231;',
  'cedil'  => '&#184;',
  'cent'   => '&#162;',
  'copy'   => '&#169;',
  'curren' => '&#164;',
  'deg'    => '&#176;',
  'divide' => '&#247;',
  'eacute' => '&#233;',
  'ecirc'  => '&#234;',
  'egrave' => '&#232;',
  'eth'    => '&#240;',
  'euml'   => '&#235;',
  'frac12' => '&#189;',
  'frac14' => '&#188;',
  'frac34' => '&#190;',
  'gt'     => '&#62;',
  'iacute' => '&#237;',
  'icirc'  => '&#238;',
  'iexcl'  => '&#161;',
  'igrave' => '&#236;',
  'iquest' => '&#191;',
  'iuml'   => '&#239;',
  'laquo'  => '&#171;',
  'lt'     => '&#60;',
  'macr'   => '&#175;',
  'micro'  => '&#181;',
  'middot' => '&#183;',
  'nbsp'   => '&#160;',
  'not'    => '&#172;',
  'ntilde' => '&#241;',
  'oacute' => '&#243;',
  'ocirc'  => '&#244;',
  'ograve' => '&#242;',
  'ordf'   => '&#170;',
  'ordm'   => '&#186;',
  'oslash' => '&#248;',
  'otilde' => '&#245;',
  'ouml'   => '&#246;',
  'para'   => '&#182;',
  'plusmn' => '&#177;',
  'pound'  => '&#163;',
  'quot'   => '&#34;',
  'raquo'  => '&#187;',
  'reg'    => '&#174;',
  'sect'   => '&#167;',
  'shy'    => '&#173;',
  'sup1'   => '&#185;',
  'sup2'   => '&#178;',
  'sup3'   => '&#179;',
  'szlig'  => '&#223;',
  'thorn'  => '&#254;',
  'times'  => '&#215;',
  'uacute' => '&#250;',
  'ucirc'  => '&#251;',
  'ugrave' => '&#249;',
  'uml'    => '&#168;',
  'uuml'   => '&#252;',
  'yacute' => '&#253;',
  'yen'    => '&#165;',
  'yuml'   => '&#255;',
);
%refParams = (
  'Content-Type' => 'CDATA+',
  'Length'       => '\d+[%]?',
  'Pixels'       => '\d+',
  'URL'          => '&URL',
  'fsize'        => '[1-7]',
  'rsize'        => '[+|-]?[1-7]',
  'border'       => '(?i)\d+|BORDER',
  'color'        => '(?i)#[0-9A-F]{6}',
  'literal'      => 'CDATA',
);

1;
