47 $raw = str_replace(
' ',
'', $this->dtd_regex);
51 $el =
'[#a-zA-Z0-9_.-]+';
58 preg_match_all(
"/$el/", $reg, $matches);
59 foreach ($matches[0] as $match) {
60 $this->elements[$match] =
true;
64 $reg = preg_replace(
"/$el/",
'(,\\0)', $reg);
67 $reg = preg_replace(
"/([^,(|]\(+),/",
'\\1', $reg);
70 $reg = preg_replace(
"/,\(/",
'(', $reg);
72 $this->_pcre_regex = $reg;
83 $list_of_children =
'';
85 foreach ($children as $node) {
86 if (!empty($node->is_whitespace)) {
89 $list_of_children .= $node->name .
',';
92 $list_of_children =
',' . rtrim($list_of_children,
',');
95 '/^,?' . $this->_pcre_regex .
'$/',
validateChildren($children, $config, $context)
$_pcre_regex
PCRE regex derived from $dtd_regex.
$dtd_regex
Allowed child pattern as defined by the DTD.
Custom validation class, accepts DTD child definitions.
Defines allowed child nodes and validates nodes against it.
_compileRegex()
Compiles the PCRE regex from a DTD regex ($dtd_regex to $_pcre_regex)