Index: XmlValidator.php =================================================================== RCS file: /repository/pear/XML_DTD/DTD/XmlValidator.php,v retrieving revision 1.3 diff -u -r1.3 XmlValidator.php --- XmlValidator.php 22 Sep 2003 17:42:04 -0000 1.3 +++ XmlValidator.php 3 Apr 2004 21:54:02 -0000 @@ -72,7 +72,7 @@ $xml_tree =& new XML_Tree($xml_file); $nodes = $xml_tree->getTreeFromFile(); if (PEAR::isError($nodes)) { - $this->_errors($nodes->getMessage()); + $this->_errors($nodes->getMessage(), 0); return false; } $dtd_parser =& new XML_DTD_Parser; @@ -147,11 +147,13 @@ } // Search for children names not allowed $was_error = false; + $childIndex = 0; foreach ($children as $child) { if (!in_array($child, $dtd_children)) { - $this->_errors("<$child> not allowed under <$name>", $lineno); + $this->_errors("<$child> not allowed under <$name>", $node->children[$childIndex]->lineno); $was_error = true; } + $childIndex++; } // Validate the order of the children if (!$was_error && count($dtd_children)) { @@ -213,7 +215,7 @@ // If there are still attributes those are not declared in DTD if (count($node_atts) > 0) { $this->_errors("The attributes: '" . implode(', ', array_keys($node_atts)) . - "' are not declared in DTD for tag <$name>"); + "' are not declared in DTD for tag <$name>", $lineno); } }