33 $raw = str_replace(
' ',
'', $this->dtd_regex);
37 $el =
'[#a-zA-Z0-9_.-]+';
44 preg_match_all(
"/$el/", $reg, $matches);
45 foreach ($matches[0] as $match) {
46 $this->elements[$match] =
true;
50 $reg = preg_replace(
"/$el/",
'(,\\0)', $reg);
53 $reg = preg_replace(
"/([^,(|]\(+),/",
'\\1', $reg);
56 $reg = preg_replace(
"/,\(/",
'(', $reg);
58 $this->_pcre_regex = $reg;
61 $list_of_children =
'';
63 foreach ($tokens_of_children as $token) {
64 if (!empty($token->is_whitespace))
continue;
66 $is_child = ($nesting == 0);
75 $list_of_children .= $token->name .
',';
79 $list_of_children =
',' . rtrim($list_of_children,
',');
82 '/^,?'.$this->_pcre_regex.
'$/',
Concrete end token class.
$_pcre_regex
PCRE regex derived from $dtd_regex.
Concrete start token class.
$dtd_regex
Allowed child pattern as defined by the DTD.
Custom validation class, accepts DTD child definitions.
Defines allowed child nodes and validates tokens against it.
_compileRegex()
Compiles the PCRE regex from a DTD regex ($dtd_regex to $_pcre_regex)
validateChildren($tokens_of_children, $config, $context)