kernel/classes/datatypes/ezxmltext/ezxmlinputparser.php
function processBySchemaPresence( $element )
    {
        $parent = $element->parentNode;
        if ( $parent instanceof DOMElement )
        {
            // If this is a foreign element, remove it
            if ( !$this->XMLSchema->exists( $element ) )
            {
                if ( $element->nodeName == 'custom' )
                {
                    $this->handleError( self::ERROR_SCHEMA,
                                        ezpI18n::tr( 'kernel/classes/datatypes/ezxmltext', "Custom tag '%1' is not allowed.",
                                        false, array( $element->getAttribute( 'name' ) ) ) );
                }
                $element = $parent->removeChild( $element );
                return false;
            }

            // Delete if children required and no children
            // If this is an auto-added element, then do not throw error

            if ( $element->nodeType == XML_ELEMENT_NODE && ( $this->XMLSchema->childrenRequired( $element ) || $element->getAttribute( 'children_required' ) )
                 && !$element->hasChildNodes() )
            {
                $element = $parent->removeChild( $element );
                if ( !$element->getAttributeNS( 'http://ez.no/namespaces/ezpublish3/temporary/', 'new-element' ) )
                {
                    $this->handleError( self::ERROR_SCHEMA, ezpI18n::tr( 'kernel/classes/datatypes/ezxmltext', "&lt;%1&gt; tag can't be empty.",
                                        false, array( $element->nodeName ) ) );
                    return false;
                }
            }
        }
        // TODO: break processing of any node that doesn't have parent
        //       and is not a root node.
        elseif ( $element->nodeName != 'section' )
        {
            return false;
        }
        return true;
    }
function processBySchemaPresence( $element )
    {
        $parent = $element->parentNode;
        if ( $parent instanceof DOMElement )
        {
            // If this is a foreign element, remove it
            if ( !$this->XMLSchema->exists( $element ) )
            {
                if ( $element->nodeName == 'custom' )
                {
                    $this->handleError( self::ERROR_SCHEMA,
                                        ezpI18n::tr( 'kernel/classes/datatypes/ezxmltext', "Custom tag '%1' is not allowed.",
                                        false, array( $element->getAttribute( 'name' ) ) ) );
                }
                $element = $parent->removeChild( $element );
                return false;
            }

            // Delete if children required and no children
            // If this is an auto-added element, then do not throw error

            if ( $element->nodeType == XML_ELEMENT_NODE && ( $this->XMLSchema->childrenRequired( $element ) || $element->getAttribute( 'children_required' ) )
                 && !$element->hasChildNodes() )
            {
                $element = $parent->removeChild( $element );
                if ( !$element->getAttributeNS( 'http://ez.no/namespaces/ezpublish3/temporary/', 'new-element' ) )
                {
                    $this->handleError( self::ERROR_SCHEMA, ezpI18n::tr( 'kernel/classes/datatypes/ezxmltext', "&lt;%1&gt; tag can't be empty.",
                                        false, array( $element->nodeName ) ) );
                    return false;
                }
            }
        }
        // TODO: break processing of any node that doesn't have parent
        //       and is not a root node.
        elseif ( $element->nodeName != 'section' )
        {
            return false;
        }
        return true;
    }
function processBySchemaPresence ( $ element ) { $ parent = $ element -> parentNode ; if ( $ parent instanceof DOMElement ) { // If this is a foreign element, remove it if ( ! $ this -> XMLSchema -> exists ( $ element ) ) { if ( $ element -> nodeName == 'custom' ) { $ this -> handleError ( self :: ERROR_SCHEMA , ezpI18n :: tr ( 'kernel/classes/datatypes/ezxmltext' , "Custom tag '%1' is not allowed." , false , array ( $ element -> getAttribute ( 'name' ) ) ) ) ; } $ element = $ parent -> removeChild ( $ element ) ; return false ; } // Delete if children required and no children // If this is an auto-added element, then do not throw error if ( $ element -> nodeType == XML_ELEMENT_NODE && ( $ this -> XMLSchema -> childrenRequired ( $ element ) || $ element -> getAttribute ( 'children_required' ) ) && ! $ element -> hasChildNodes ( ) ) { $ element = $ parent -> removeChild ( $ element ) ; if ( ! $ element -> getAttributeNS ( 'http://ez.no/namespaces/ezpublish3/temporary/' , 'new-element' ) ) { $ this -> handleError ( self :: ERROR_SCHEMA , ezpI18n :: tr ( 'kernel/classes/datatypes/ezxmltext' , "&lt;%1&gt; tag can't be empty." , false , array ( $ element -> nodeName ) ) ) ; return false ; } } } // TODO: break processing of any node that doesn't have parent //       and is not a root node. elseif ( $ element -> nodeName != 'section' ) { return false ; } return true ; }
Check if the element is allowed to exist in this document and remove it if not.
Check if the element is allowed to exist in this document and remove it if not .