private function _xmlStartElement($parser, $name, $attributes) { $last = null; if (count($this->_tagStack)) { $last =& $this->_tagStack[count($this->_tagStack) - 1]; if ($this->_currentCharacterData) { $last->appendText($this->_currentCharacterData); $this->_currentCharacterData = ''; } } if ($last) { $currentDoctype = $last->doctype(); } else { $currentDoctype = $this->_doctype; } foreach ($attributes as $k => $v) { if ($k == 'xmlns' || substr($k, 0, 6) == 'xmlns:') { $doctype = Pagemill_Doctype::ForNamespaceUri($v, substr($k, 6)); $currentDoctype->merge($doctype); if (!$doctype->keepNamespaceDeclarationInOutput()) { unset($attributes[$k]); } } else { if (substr($k, 0, 3) == 'pm:' && !isset($this->_namespaces['pm'])) { // Declare the Template doctype using the default pm prefix $this->_namespaces['pm'] = 'http://typeframe.com/pagemill'; $pm = Pagemill_Doctype::GetTemplateDoctype('pm'); $currentDoctype->merge($pm); } } } if (substr($name, 0, 3) == 'pm:' && !isset($this->_namespaces['pm'])) { // Declare the Template doctype using the default pm prefix $this->_namespaces['pm'] = 'http://typeframe.com/pagemill'; $pm = Pagemill_Doctype::GetTemplateDoctype('pm'); $currentDoctype->merge($pm); } $tagRegistry = $currentDoctype->tagRegistry(); if (isset($tagRegistry[$name])) { $cls = $tagRegistry[$name]; $tag = new $cls($name, $attributes, $last, $currentDoctype); } else { $tag = new Pagemill_Tag($name, $attributes, $last, $currentDoctype); } if (!count($this->_tagStack)) { // This appears to be a root element, so append the headers. $header = trim("{$this->_xmlDeclString}\n{$this->_doctypeString}\n"); $tag->header($header); } $this->_tagStack[] = $tag; }