Modified on Saturday 12 April 2008 4:16:14 am by Aleksey Tik
2 replies
Author
Message
Bastian Fenske
Tuesday 15 April 2008 2:13:13 am
This works for me:
// Remove only nodes that don't match schema (recursively)
function fixSubtree( $element, &$mainChild )
{
$parent = $element->parentNode;
$mainParent = $mainChild->parentNode;
if ( $element->hasChildNodes() )
{
// http://php.net/manual/en/domnode.removechild.php#56556
$childNodes = array();
foreach($element->childNodes as $childNode) {
$childNodes[] = $childNode;
}
foreach ($childNodes as $childNode) {
$childNode = $childNode->parentNode->removeChild($childNode);
$childNode = $mainParent->insertBefore( $childNode, $mainChild );
if ( !$this->XMLSchema->check( $mainParent, $childNode ) )
{
$this->fixSubtree( $childNode, $mainChild );
}
}
}
$element = $parent->removeChild( $element );
}
Basti
Carsten Koehler
Monday 07 July 2008 2:30:56 am
I had the same error message. After the change, I was able to save again.
But now I have a new problem. Newly created articles are completely saved as a link to itself. Modify I then a second time, the text layout is saved as I wish. How can I eliminate this problem?
You must be logged in to post messages in this topic!