eZXMLInputParser::removeAllAttributes PHP Method

removeAllAttributes() public method

*! Removes all attribute nodes from element node $element
public removeAllAttributes ( DOMElement $element )
$element DOMElement
    function removeAllAttributes(DOMElement $element)
    {
        $attribs = $element->attributes;
        for ($i = $attribs->length - 1; $i >= 0; $i--) {
            $element->removeAttributeNode($attribs->item($i));
        }
    }

Usage Example

Ejemplo n.º 1
0
 function processNewElements($createdElements)
 {
     $debug = eZDebugSetting::isConditionTrue('kernel-datatype-ezxmltext', eZDebug::LEVEL_DEBUG);
     // Call handlers for newly created elements
     foreach ($createdElements as $element) {
         if ($debug) {
             eZDebug::writeDebug('processing new element ' . $element->nodeName, eZDebugSetting::changeLabel('kernel-datatype-ezxmltext'));
         }
         $tmp = null;
         if (!$this->processBySchemaPresence($element)) {
             if ($debug) {
                 eZDebug::writeDebug($this->Document->saveXML(), eZDebugSetting::changeLabel('kernel-datatype-ezxmltext', 'xml string after failed processBySchemaPresence for new element ' . $element->nodeName));
             }
             continue;
         }
         if ($debug) {
             eZDebug::writeDebug($this->Document->saveXML(), eZDebugSetting::changeLabel('kernel-datatype-ezxmltext', 'xml string after processBySchemaPresence for new element ' . $element->nodeName));
         }
         // Call "Structure handler"
         $this->callOutputHandler('structHandler', $element, $tmp);
         if (!$this->processBySchemaTree($element)) {
             if ($debug) {
                 eZDebug::writeDebug($this->Document->saveXML(), eZDebugSetting::changeLabel('kernel-datatype-ezxmltext', 'xml string after failed processBySchemaTree for new element ' . $element->nodeName));
             }
             continue;
         }
         if ($debug) {
             eZDebug::writeDebug($this->Document->saveXML(), eZDebugSetting::changeLabel('kernel-datatype-ezxmltext', 'xml string after processBySchemaTree for new element ' . $element->nodeName));
         }
         $tmp2 = null;
         // Call "Publish handler"
         $this->callOutputHandler('publishHandler', $element, $tmp2);
         if ($debug) {
             eZDebug::writeDebug($this->Document->saveXML(), eZDebugSetting::changeLabel('kernel-datatype-ezxmltext', 'xml string after callOutputHandler publishHandler for new element ' . $element->nodeName));
         }
         // Process attributes according to the schema
         if ($element->hasAttributes()) {
             if (!$this->XMLSchema->hasAttributes($element)) {
                 eZXMLInputParser::removeAllAttributes($element);
             } else {
                 $this->processAttributesBySchema($element);
             }
         }
     }
 }