Index: design/standard/templates/ezodf/import.tpl
===================================================================
--- design/standard/templates/ezodf/import.tpl	(revision 3273)
+++ design/standard/templates/ezodf/import.tpl	(working copy)
@@ -29,7 +29,7 @@
 <h2>{"Document is now imported"|i18n("extension/ezodf")}</h2>
 <ul>
   <li>{"The object was imported as: %class_name"|i18n('extension/ezodf','', hash( '%class_name', $class_identifier ) )}</li>
-  <li>{"Document imported as"|i18n("extension/ezodf")} <a href={$url_alias|ezurl}>{$node_name}</a>.</li>
+  <li>{"Document imported as"|i18n("extension/ezodf")} <a href={$url_alias|ezurl}>{$node_name|wash}</a>.</li>
   <li>{"The images are placed in the media library and can be re-used."|i18n("extension/ezodf")}</li>
   <li><a href={"/ezodf/import"|ezurl}>{"Import another document"|i18n("extension/ezodf")}</a></li>
 </ul>
Index: modules/ezodf/authenticate.php
===================================================================
--- modules/ezodf/authenticate.php	(revision 3273)
+++ modules/ezodf/authenticate.php	(working copy)
@@ -82,7 +82,7 @@
 
         //Convert the array into a string and display it
         $display = '';
-        foreach( $array as $line )
+        foreach ( $array as $line )
         {
             foreach( $line as $element )
             {
Index: modules/ezodf/export.php
===================================================================
--- modules/ezodf/export.php	(revision 3273)
+++ modules/ezodf/export.php	(working copy)
@@ -26,16 +26,8 @@
 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
 //
 
-include_once( "kernel/common/template.php" );
+require_once( "kernel/common/template.php" );
 
-include_once( 'kernel/classes/ezcontentobject.php' );
-include_once( 'lib/ezlocale/classes/ezdatetime.php' );
-
-include_once( "kernel/classes/ezcontentbrowse.php" );
-
-include_once( "extension/ezodf/modules/ezodf/ezooconverter.php" );
-
-
 $http = eZHTTPTool::instance();
 $module = $Params["Module"];
 $NodeID = $Params['NodeID'];
@@ -95,9 +87,9 @@
 {
     $exportType = $exportTypeParam;
 }
-else if ( strlen( trim ( $exportTypeParam) ) != 0 )
+else if ( strlen( trim( $exportTypeParam ) ) != 0 )
 {
-    $tpl->setVariable( "error_string", ezi18n( 'extension/ezodf/export/error',"Destination file format not supported" ) );
+    $tpl->setVariable( "error_string", ezi18n( 'extension/ezodf/export/error', "Destination file format not supported" ) );
     $success = false;
 }
 
@@ -107,10 +99,8 @@
 
 if ( $doExport == true )
 {
-
     if ( is_numeric( $nodeID ) )
     {
-
         $node = eZContentObjectTreeNode::fetch( $nodeID );
 
         // Check if we have read access to this node
@@ -126,7 +116,6 @@
                 $originalFileName = $nodeName . ".odt";
                 $contentType = "application/vnd.oasis.opendocument.text";
 
-                include_once( 'lib/ezi18n/classes/ezchartransform.php' );
                 $trans = eZCharTransform::instance();
                 $nodeName = $trans->transformByGroup( $nodeName, 'urlalias' );
 
@@ -150,9 +139,8 @@
                             $success = false;
                             $tpl->setVariable( "error_string", ezi18n( 'extension/ezodf/export/error',"PDF conversion failed" ) );
                         }
+                    } break;
 
-                    }break;
-
                     case "Word" :
                     {
                         if ( ( $result = daemonConvert( $server, $port, realpath( $fileName ), "convertToDoc", $tmpDir . "/ooo_converted_$uniqueStamp.doc" ) ) )
@@ -166,11 +154,8 @@
                             $success = false;
                             $tpl->setVariable( "error_string", ezi18n( 'extension/ezodf/export/error',"Word conversion failed" ) );
                         }
-
-                    }break;
-
+                    } break;
                 }
-
             }
             else
             {
@@ -194,7 +179,7 @@
                 // Download the file
                 header( "Pragma: " );
                 header( "Cache-Control: " );
-                /* Set cache time out to 10 minutes, this should be good enough to work around an IE bug */
+                // Set cache time out to 10 minutes, this should be good enough to work around an IE bug
                 header( "Expires: ". gmdate('D, d M Y H:i:s', time() + 600) . 'GMT');
                 header( "Content-Length: $contentLength" );
                 header( "Content-Type: $contentType" );
@@ -219,7 +204,7 @@
             }
             else
             {
-                $tpl->setVariable( "error_string", ezi18n( 'extension/ezodf/export/error',"Unable to open file %1 on server side", null, array( $fileName ) ) );
+                $tpl->setVariable( "error_string", ezi18n( 'extension/ezodf/export/error', "Unable to open file %1 on server side", null, array( $fileName ) ) );
             }
         }
     }
Index: modules/ezodf/ezooconverter.php
===================================================================
--- modules/ezodf/ezooconverter.php	(revision 3273)
+++ modules/ezodf/ezooconverter.php	(working copy)
@@ -30,8 +30,6 @@
 
 /*! \file ezooconverter.php
 */
-include_once( "extension/ezodf/modules/ezodf/ezoogenerator.php" );
-include_once( "lib/ezxml/classes/ezxml.php" );
 
 /*!
   \class eZOoconverter ezooconverter.php
@@ -54,402 +52,260 @@
     */
     static function objectToOO( $nodeID )
     {
+        $node = eZContentObjectTreeNode::fetch( $nodeID );
+
+        if ( !is_object( $node ) )
+        {
+            return false;
+        }
+
         $ooGenerator = new eZOOGenerator();
 
-        $node = eZContentObjectTreeNode::fetch( $nodeID );
+        $object = $node->attribute( 'object' );
+        $attributes = $object->contentObjectAttributes();
 
-        if ( $node )
+        $supportedDatatypes = array( 'ezstring', 'eztext', 'ezxmltext', 'ezimage', 'ezdate', 'ezdatetime', 'ezmatrix' );
+
+        foreach ( $attributes as $attribute )
         {
-            $object = $node->attribute( 'object' );
-            $attributes = $object->contentObjectAttributes();
-            $xml = new eZXML();
+            $datatype = $attribute->attribute( 'data_type_string' );
+            $identifier = $attribute->attribute( "contentclass_attribute_identifier" );
 
-            // Clear the view cache when exporting, for some reason images are re-generated and the resolution is becomming poor
-            include_once( "kernel/classes/ezcontentcachemanager.php" );
-            eZContentCacheManager::clearObjectViewCache( $object->attribute( "id" ) );
+            if ( !in_array( $datatype, $supportedDatatypes ) )
+            {
+                eZDebug::writeError( "Attribute '$identifier' with unsupported datatype '$datatype' for OO conversion" );
+                continue;
+            }
 
-            foreach ( $attributes as $attribute )
+            $ooGenerator->startSection( $identifier );
+
+            switch ( $datatype )
             {
-                switch ( $attribute->attribute( 'data_type_string' ) )
+                case "ezstring":
                 {
-                    case "ezstring":
+                    $text = trim( $attribute->content() );
+                    if ( $text != "" )
                     {
-                        $text = trim( $attribute->content() );
-                        if ( $text != "" )
-                        {
-                            $ooGenerator->startSection( $attribute->attribute( "contentclass_attribute_identifier" ) );
-                            $ooGenerator->addHeader( $attribute->content() );
-                            $ooGenerator->endSection( );
-                        }
-                    }break;
+                        $ooGenerator->addHeader( $text );
+                    }
+                } break;
 
-                    case "eztext":
-                    {
-                        $ooGenerator->startSection( $attribute->attribute( "contentclass_attribute_identifier" ) );
-                        $ooGenerator->addParagraph( $attribute->content() );
-                        $ooGenerator->endSection();
+                case "eztext":
+                {
+                    $ooGenerator->addParagraph( $attribute->content() );
 
-                    }break;
+                } break;
 
-                    case "ezxmltext":
+                case "ezxmltext":
+                {
+                    $xmlData = $attribute->attribute( 'data_text' );
+                    $dom = new DOMDocument( '1.0', 'UTF-8' );
+                    $dom->preserveWhiteSpace = false;
+                    $success = $dom->loadXML( $xmlData );
+                    if ( $success )
                     {
-                        $ooGenerator->startSection( $attribute->attribute( "contentclass_attribute_identifier" ) );
-
-                        $xmlData = $attribute->attribute( 'data_text' );
-                        $domTree = $xml->domTree( $xmlData );
-                        if ( $domTree )
+                        $root = $dom->documentElement;
+                        foreach ( $root->childNodes as $node )
                         {
-                            $root = $domTree->root();
-                            foreach ( $root->children() as $node )
-                            {
-                                eZOOConverter::handleNode( $node, $ooGenerator );
-                            }
+                            self::handleNode( $node, $ooGenerator );
                         }
-                        $ooGenerator->endSection( );
-                    }break;
-
-
-                    case "ezimage":
+                    }
+                    else
                     {
-                        $ooGenerator->startSection( $attribute->attribute( "contentclass_attribute_identifier" ) );
+                        eZDebug::writeError( "Unable to load XML data for attribute '$identifier'" );
+                    }
+                } break;
 
-                        $imageHandler = $attribute->content();
-                        $originalImage = $imageHandler->attribute( 'original' );
-                        $displayImage = $imageHandler->attribute( 'original' );
-                        $displayWidth = $displayImage['width'];
-                        $displayHeight = $displayImage['height'];
+                case "ezimage":
+                {
+                    $originalImage = $attribute->content()->attribute( 'original' );
 
-                        $imageArray = array( "FileName" => $originalImage['url'],
-                                               "Alignment" => "center",
-                                               "DisplayWidth" => $displayWidth,
-                                               "DisplayHeight" => $displayHeight );
+                    $imageArray = array( "FileName" => $originalImage['url'],
+                                         "Alignment" => "center",
+                                         "DisplayWidth" => $originalImage['width'],
+                                         "DisplayHeight" => $originalImage['height'] );
 
-                        $ooGenerator->addImage( $imageArray);
+                    $ooGenerator->addImage( $imageArray );
+                } break;
 
-                        $ooGenerator->endSection();
+                case "ezdate":
+                {
+                    $date = $attribute->content();
+                    $ooGenerator->addParagraph( $date->attribute( "day" ) . "/" . $date->attribute( "month" ) . "/" . $date->attribute( "year" ) );
+                } break;
 
-                    }break;
+                case "ezdatetime":
+                {
+                    $date = $attribute->content();
+                    $ooGenerator->addParagraph( $date->attribute( "day" ) . "/" . $date->attribute( "month" ) . "/" . $date->attribute( "year" ) . " " . $date->attribute( "hour" )  . ":" . $date->attribute( "minute" )  );
+                } break;
 
-                    case "ezdate":
-                    {
-                        $ooGenerator->startSection( $attribute->attribute( "contentclass_attribute_identifier" ) );
+                case "ezmatrix":
+                {
+                    $matrix = $attribute->content();
+                    $columns = $matrix->attribute( "columns" );
 
-                        $date = $attribute->content();
-                        $ooGenerator->addParagraph( $date->attribute( "day" ) . "/" . $date->attribute( "month" ) . "/" . $date->attribute( "year" ) );
+                    $ooGenerator->startTable();
 
-                        $ooGenerator->endSection();
-
-                    }break;
-
-
-                    case "ezdatetime":
+                    foreach ( $columns['sequential'] as $column )
                     {
-                        $ooGenerator->startSection( $attribute->attribute( "contentclass_attribute_identifier" ) );
+                        $ooGenerator->addParagraph( $column['name'] );
+                        $ooGenerator->nextCell();
+                    }
 
-                        $date = $attribute->content();
-                        $ooGenerator->addParagraph( $date->attribute( "day" ) . "/" . $date->attribute( "month" ) . "/" . $date->attribute( "year" ) . " " . $date->attribute( "hour" )  . ":" . $date->attribute( "minute" )  );
+                    $ooGenerator->nextRow( "defaultstyle" );
 
-                        $ooGenerator->endSection();
+                    $rows = $matrix->attribute( "rows" );
 
-                    }break;
-
-                    case "ezmatrix":
+                    foreach ( $rows['sequential'] as $row )
                     {
-                        $ooGenerator->startSection( $attribute->attribute( "contentclass_attribute_identifier" ) );
-
-                        $matrix = $attribute->content();
-
-                        $columns = $matrix->attribute( "columns" );
-
-                        $ooGenerator->startTable();
-
-                        foreach ( $columns['sequential'] as $column )
+                        foreach ( $row['columns'] as $cell )
                         {
-                            $ooGenerator->addParagraph( $column['name'] );
+                            $ooGenerator->addParagraph( $cell );
                             $ooGenerator->nextCell();
                         }
-
                         $ooGenerator->nextRow( "defaultstyle" );
+                    }
 
-                        $rows = $matrix->attribute( "rows" );
-
-                        foreach ( $rows['sequential'] as $row )
-                        {
-                            foreach ( $row['columns'] as $cell )
-                            {
-                                $ooGenerator->addParagraph( $cell );
-                                $ooGenerator->nextCell();
-                            }
-                            $ooGenerator->nextRow( "defaultstyle" );
-                        }
-
-                        $ooGenerator->endTable();
-
-                        $ooGenerator->endSection();
-
-                    }break;
-
-                    default:
-                    {
-                        eZDebug::writeError( "Unsupported attribute for OO conversion: '" . $attribute->attribute( 'data_type_string' ) . "'" );
-                    }break;
-                }
+                    $ooGenerator->endTable();
+                } break;
             }
 
-
-            /*
-            $ooGenerator->addHeader( "Test code from here" );
-
-            $ooGenerator->startList( "unordered" );
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextListItem();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextListItem();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextListItem();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextListItem();
-            $ooGenerator->endList( );
-
-            $ooGenerator->startList( "ordered" );
-            $ooGenerator->addParagraph( "Level 2" );
-            $ooGenerator->nextListItem();
-            $ooGenerator->addParagraph( "Level 2" );
-            $ooGenerator->nextListItem();
-            $ooGenerator->addParagraph( "Level 2" );
-            $ooGenerator->nextListItem();
-            $ooGenerator->addParagraph( "Level 2" );
-            $ooGenerator->nextListItem();
-
-
-            $ooGenerator->endList( );
-            */
-/*
-            $ooGenerator->startTable();
-            $ooGenerator->setCurrentColSpan( 2 );
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell(2);
-            $ooGenerator->setCurrentColSpan( 2 );
-
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-
-            $ooGenerator->nextRow( "defaultstyle" );
-
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-
-            $ooGenerator->nextRow( "defaultstyle" );
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-
-            $ooGenerator->endTable();
-*/
-
-            /*
-            $ooGenerator->addHeader( "This is generated from PHP!!" );
-
-            $ooGenerator->addParagraph( array( eZOOGenerator::STYLE_START, "bold" ),
-                                        array( eZOOGenerator::TEXT, "Pent vaaaar i dag"),
-                                        array( eZOOGenerator::STYLE_STOP ),
-                                        array( eZOOGenerator::LINK, "eZ systems", "http://ez.no"),
-                                        array( eZOOGenerator::TEXT, "Test" ) );
-
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->addHeader( "This is generated from PHP!!" );
-
-            $ooGenerator->addImage( "documents/ooo_logo.gif" );
-
-            $paragraph = $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-
-            // Generating a list
-            $ooGenerator->startList( "bullet/numbered" );
-
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->addImage( "documents/ooo_logo.gif" );
-
-            $ooGenerator->nextListItem();
-
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->addHeader( "This is generated from PHP!!" );
-            $ooGenerator->addImage( "documents/ooo_logo.gif" );
-
-            $ooGenerator->endList();
-
-            */
-            /*
-            // Generate a table
-            $ooGenerator->startTable();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-
-            $ooGenerator->nextRow( "defaultstyle" );
-
-            $ooGenerator->addParagraph( "This is just a sample paragraph. And it's of course added via PHP." );
-            $ooGenerator->nextCell();
-            $ooGenerator->nextCell();
-
-            $ooGenerator->endTable();
-
-            $ooGenerator->addParagraph( "Preformatted_20_Text", array( eZOOGenerator::TEXT, "This is just a sample paragraph. And it's of course added via PHP." ) );
-            $ooGenerator->addParagraph( "eZ_PRE_style", "Normal text here." );
-
-            */
-
-
-            $destFile = $ooGenerator->writeDocument();
-
-            return $destFile;
+            $ooGenerator->endSection();
         }
 
-        // Conversion failed
-        return false;
+        return $ooGenerator->writeDocument();
     }
 
     /*!
      \private
      Internal function to handle an eZXMLText node and convert it to OO format
     */
-    static function handleNode( $node, &$generator, $level = 0 )
+    static function handleNode( $node, $generator, $level = 0 )
     {
-        switch ( $node->name() )
+        switch ( $node->localName )
         {
             case "section":
             {
-                foreach ( $node->children() as $childNode )
+                foreach ( $node->childNodes as $childNode )
                 {
-                    eZOOConverter::handleNode( $childNode, $generator, $level + 1 );
+                    self::handleNode( $childNode, $generator, $level + 1 );
                 }
-            }break;
+            } break;
 
             case "header":
             {
                 if ( $level == 0 )
                     $level = 1;
-                $generator->addHeader( trim( $node->textContent() ), $level );
-            }break;
+                $generator->addHeader( trim( $node->textContent ), $level );
+            } break;
 
             case "ul":
             case "ol":
             {
-                eZOOConverter::handleInlineNode( $node, $generator, $level );
-            }break;
+                self::handleInlineNode( $node, $generator, $level );
+            } break;
 
             case "paragraph":
             {
                 $paragraphParameters = array();
                 $imageArray = array();
-                foreach ( $node->children() as $child )
+
+                foreach ( $node->childNodes as $child )
                 {
-                    $return = eZOOConverter::handleInlineNode( $child, $generator );
-                    $paragraphParameters = array_merge( $paragraphParameters,  $return['paragraph_parameters'] );
-                    $imageArray = $return['image_array'];
+                    $return = self::handleInlineNode( $child, $generator );
+                    $paragraphParameters = array_merge( $paragraphParameters, $return['paragraph_parameters'] );
+                    $imageArray = array_merge( $imageArray, $return['image_array'] );
                 }
+
                 foreach ( $imageArray as $image )
                 {
                     $generator->addImage( $image );
                 }
 
                 if ( isset( $GLOBALS['CustomTagStyle'] ) and $GLOBALS['CustomTagStyle'] != false )
-                    call_user_func_array( array( &$generator, "addParagraph" ), array_merge( $GLOBALS['CustomTagStyle'], $paragraphParameters ) );
-                else
-                    call_user_func_array( array( &$generator, "addParagraph" ), $paragraphParameters );
-            }break;
+                {
+                    $paragraphParameters = array_merge( $GLOBALS['CustomTagStyle'], $paragraphParameters );
+                }
 
+                call_user_func_array( array( $generator, "addParagraph" ), $paragraphParameters );
+            } break;
+
             default:
             {
-
-                eZDebug::writeError( "Unsupported node for document conversion: " . $node->name() );
-            }break;
+                eZDebug::writeError( "Unsupported node for document conversion: " . $node->localName );
+            }
         }
     }
 
-    static function handleInlineNode( $child, &$generator )
+    static function handleInlineNode( $child, $generator )
     {
         $paragraphParameters = array();
         $imageArray = array();
 
-        switch ( $child->name() )
+        switch ( $child->localName )
         {
             case "line":
             {
                 // Todo: support inline tags
-                $paragraphParameters[] = array( eZOOGenerator::TEXT, $child->textContent() );
+                $paragraphParameters[] = array( eZOOGenerator::TEXT, $child->textContent );
 
-                foreach ( $child->children() as $lineChild )
+                foreach ( $child->childNodes as $lineChild )
                 {
-                    switch ( $lineChild->name() )
+                    if ( $lineChild->localName == 'embed' )
                     {
-                        case "embed":
+                        // Only support objects of image class for now
+                        $object = eZContentObject::fetch( $lineChild->getAttribute( "object_id" ) );
+                        if ( $object && $object->canRead() )
                         {
-                            // Only support objects of image class for now
-                            $object = eZContentObject::fetch( $lineChild->attributeValue( "object_id" ) );
-                            if ( $object && $object->canRead() )
+                            $classIdentifier = $object->attribute( "class_identifier" );
+
+                            // Todo: read class identifiers from configuration
+                            if ( $classIdentifier == "image" )
                             {
+                                $imageSize = $lineChild->getAttribute( 'size' );
+                                if ( $imageSize == "" )
+                                    $imageSize = "large";
+                                $imageAlignment = $lineChild->getAttribute( 'align' );
+                                if ( $imageAlignment == "" )
+                                    $imageAlignment = "center";
 
-                                $classIdentifier = $object->attribute( "class_identifier" );
+                                $dataMap = $object->dataMap();
+                                $imageAttribute = $dataMap['image'];
 
-                                // Todo: read class identifiers from configuration
-                                if ( $classIdentifier == "image" )
-                                {
-                                    $imageSize = $lineChild->attributeValue( 'size' );
-                                    if ( $imageSize == "" )
-                                        $imageSize = "large";
-                                    $imageAlignment = $lineChild->attributeValue( 'align' );
-                                    if ( $imageAlignment == "" )
-                                        $imageAlignment = "center";
-
-                                    $dataMap = $object->dataMap();
-                                    $imageAttribute = $dataMap['image'];
-
-                                    $imageHandler = $imageAttribute->content();
-                                    $originalImage = $imageHandler->attribute( 'original' );
-                                    $displayImage = $imageHandler->attribute( $imageSize );
-                                    $displayWidth = $displayImage['width'];
-                                    $displayHeight = $displayImage['height'];
-                                    $imageArray[] = array( "FileName" => $originalImage['url'],
-                                                           "Alignment" => $imageAlignment,
-                                                           "DisplayWidth" => $displayWidth,
-                                                           "DisplayHeight" => $displayHeight );
-                                }
+                                $imageHandler = $imageAttribute->content();
+                                $originalImage = $imageHandler->attribute( 'original' );
+                                $displayImage = $imageHandler->attribute( $imageSize );
+                                $displayWidth = $displayImage['width'];
+                                $displayHeight = $displayImage['height'];
+                                $imageArray[] = array( "FileName" => $originalImage['url'],
+                                                       "Alignment" => $imageAlignment,
+                                                       "DisplayWidth" => $displayWidth,
+                                                       "DisplayHeight" => $displayHeight );
                             }
-                            else
-                            {
-                                eZDebug::writeError( "Image (object_id = " . $child->attributeValue( 'object_id' ) . " ) could not be used (does not exist or due to insufficient privileges)" );
-                            }
-                        }break;
+                        }
+                        else
+                        {
+                            eZDebug::writeError( "Image (object_id = " . $child->getAttribute( 'object_id' ) . " ) could not be used (does not exist or due to insufficient privileges)" );
+                        }
                     }
                 }
-            }break;
+            } break;
 
-            case "#text":
+            // text nodes
+            case "":
             {
-                $paragraphParameters[] = array( eZOOGenerator::TEXT, $child->content() );
-            }break;
+                $paragraphParameters[] = array( eZOOGenerator::TEXT, $child->textContent );
+            } break;
 
             case "link":
             {
-                $href = $child->attributeValue( 'href' );
+                $href = $child->getAttribute( 'href' );
                 if ( !$href )
                 {
-                    $url_id = $child->attributeValue( 'url_id' );
+                    $url_id = $child->getAttribute( 'url_id' );
                     if ( $url_id )
                     {
-                        include_once( 'kernel/classes/datatypes/ezurl/ezurl.php' );
                         $eZUrl = eZURL::fetch( $url_id );
                         if ( is_object( $eZUrl ) )
                         {
@@ -458,37 +314,27 @@
                     }
                 }
 
-                $paragraphParameters[] = array( eZOOGenerator::LINK, $href, $child->textContent() );
-            }break;
+                $paragraphParameters[] = array( eZOOGenerator::LINK, $href, $child->textContent );
+            } break;
 
             case "emphasize":
+            case "strong":
             {
-                $paragraphParameters[] = array( eZOOGenerator::STYLE_START, "italic" );
+                $style = $child->localName == 'strong' ? 'bold' : 'italic';
+                $paragraphParameters[] = array( eZOOGenerator::STYLE_START, $style );
 
-                foreach ( $child->children() as $inlineNode )
+                foreach ( $child->childNodes as $inlineNode )
                 {
-                    $return = eZOOConverter::handleInlineNode( $inlineNode );
+                    $return = self::handleInlineNode( $inlineNode );
                     $paragraphParameters = array_merge( $paragraphParameters, $return['paragraph_parameters'] );
                 }
 
                 $paragraphParameters[] = array( eZOOGenerator::STYLE_STOP );
-            }break;
+            } break;
 
-            case "strong":
-            {
-                $paragraphParameters[] = array( eZOOGenerator::STYLE_START, "bold" );
-
-                foreach ( $child->children() as $inlineNode )
-                {
-                    $return = eZOOConverter::handleInlineNode( $inlineNode );
-                    $paragraphParameters = array_merge( $paragraphParameters, $return['paragraph_parameters'] );
-                }
-                $paragraphParameters[] = array( eZOOGenerator::STYLE_STOP );
-            }break;
-
             case "literal":
             {
-                $literalContent = $child->textContent();
+                $literalContent = $child->textContent;
 
                 $literalContentArray = explode( "\n", $literalContent );
                 foreach ( $literalContentArray as $literalLine )
@@ -496,158 +342,117 @@
                     $generator->addParagraph( "Preformatted_20_Text", htmlspecialchars( $literalLine ) );
                 }
 
-            }break;
+            } break;
 
             case "custom":
             {
-                $customTagName = $child->attributeValue( 'name' );
+                $customTagName = $child->getAttribute( 'name' );
 
                 // Check if the custom tag is inline
-                $isInline = false;
-                include_once( "lib/ezutils/classes/ezini.php" );
                 $ini = eZINI::instance( 'content.ini' );
 
                 $isInlineTagList = $ini->variable( 'CustomTagSettings', 'IsInline' );
-                foreach ( array_keys ( $isInlineTagList ) as $key )
-                {
-                    $isInlineTagValue =& $isInlineTagList[$key];
-                    if ( $isInlineTagValue )
-                    {
-                        if ( $customTagName == $key )
-                            $isInline = true;
-                    }
-                }
+                $isInline = ( array_key_exists( $customTagName, $isInlineTagList ) && $isInlineTagList[$customTagName] );
 
                 // Handle inline custom tags
-                if ( $isInline == true )
+                if ( $isInline )
                 {
                     $paragraphParameters[] = array( eZOOGenerator::STYLE_START, "eZCustominline_20_$customTagName" );
-                    $paragraphParameters[] = array( eZOOGenerator::TEXT, $child->textContent() );
+                    $paragraphParameters[] = array( eZOOGenerator::TEXT, $child->textContent );
                     $paragraphParameters[] = array( eZOOGenerator::STYLE_STOP );
                 }
                 else
                 {
                     $GLOBALS['CustomTagStyle'] = "eZCustom_20_$customTagName";
-
-                    foreach ( $child->children() as $customParagraph )
+                    foreach ( $child->childNodes as $customParagraph )
                     {
-                        eZOOConverter::handleNode( $customParagraph, $generator, $level );
+                        self::handleNode( $customParagraph, $generator );
                     }
-
                     $GLOBALS['CustomTagStyle'] = false;
                 }
-            }break;
+            } break;
 
             case "ol":
             case "ul":
             {
-                if ( $child->name() == "ol" )
-                    $generator->startList( "ordered" );
-                else
-                    $generator->startList( "unordered" );
+                $listType = $child->localName == "ol" ? "ordered" : "unordered";
+                $generator->startList( $listType );
 
-                foreach ( $child->children() as $listItem )
+                foreach ( $child->childNodes as $listItem )
                 {
-                    foreach ( $listItem->children() as $childNode )
+                    foreach ( $listItem->childNodes as $childNode )
                     {
-                        if ( $childNode->name() == "#text" )
-                            $generator->addParagraph( $childNode->content() );
+                        if ( $childNode->nodeType == XML_TEXT_NODE )
+                        {
+                            $generator->addParagraph( $childNode->textContent );
+                        }
                         else
                         {
-                            eZOOConverter::handleNode( $childNode, $generator, $level );
+                            self::handleNode( $childNode, $generator );
                         }
                     }
                     $generator->nextListItem();
                 }
                 $generator->endList();
-            }break;
+            } break;
 
             case "table":
             {
                 $generator->startTable();
                 $rows = 1;
-                foreach ( $child->children() as $row )
+                foreach ( $child->childNodes as $row )
                 {
-                    foreach ( $row->children() as $cell )
+                    foreach ( $row->childNodes as $cell )
                     {
                         // Set the correct col span
-                        $colSpan = $cell->attributeValue( "colspan" );
+                        $colSpan = $cell->getAttribute( "colspan" );
                         if ( is_numeric( $colSpan ) )
                         {
                             $generator->setCurrentColSpan( $colSpan );
                         }
                         // Check for table header
-                        $rowName = $cell->name();
-                        if ( $rowName == 'th' and $rows == 1 )
+                        if ( $cell->localName == 'th' and $rows == 1 )
                         {
                             $generator->setIsInsideTableHeading( true );
                         }
 
-                        foreach ( $cell->children() as $cellNode )
+                        // If the cell is empty, create a dummy so the cell is properly exported
+                        if ( !$cell->hasChildNodes() )
                         {
-                            eZOOConverter::handleNode( $cellNode, $generator, $level );
+                            $dummy = $cell->ownerDocument->createElement( "paragraph" );
+                            $cell->appendChild( $dummy );
                         }
-                        // If the cell is empty, create a dummy so the cell is properly exported
-                        if ( count( $cell->children() ) == 0 )
+
+                        eZDebug::writeDebug( $cell->ownerDocument->saveXML( $cell ), 'ezxmltext table cell' );
+                        foreach ( $cell->childNodes as $cellNode )
                         {
-                            $n = new eZDOMNode();
-                            $n->setType( 1 );
-                            $n->setName( "paragraph" );
-                            eZOOConverter::handleNode( $n, $generator, $level );
+                            self::handleNode( $cellNode, $generator );
                         }
+
                         $generator->nextCell();
                     }
                     $generator->nextRow();
                     ++$rows;
                 }
                 $generator->endTable();
-            }break;
+            } break;
 
-            case "object":
+            case 'object':
+            case 'embed':
             {
-                // Only support objects of image class for now
-                $object = eZContentObject::fetch( $child->attributeValue( "id" ) );
-                if ( $object )
-                {
-                    $classIdentifier = $object->attribute( "class_identifier" );
+                $objectID = $child->localName == 'embed' ? $child->getAttribute( "object_id" ) : $child->getAttribute( "id" );
 
-                    // Todo: read class identifiers from configuration
-                    if ( $classIdentifier == "image" )
-                    {
-                        $imageSize = $child->attributeValue( 'size' );
-                        $imageAlignment = $child->attributeValue( 'align' );
-
-                        $dataMap = $object->dataMap();
-                        $imageAttribute = $dataMap['image'];
-
-                        $imageHandler = $imageAttribute->content();
-                        $originalImage = $imageHandler->attribute( 'original' );
-                        $displayImage = $imageHandler->attribute( $imageSize );
-                        $displayWidth = $displayImage['width'];
-                        $displayHeight = $displayImage['height'];
-                        $imageArray[] = array( "FileName" => $originalImage['url'],
-                                               "Alignment" => $imageAlignment,
-                                               "DisplayWidth" => $displayWidth,
-                                               "DisplayHeight" => $displayHeight );
-                    }
-                }
-
-            }break;
-
-            case "embed":
-            {
-                // Only support objects of image class for now and those we can read
-                $object = eZContentObject::fetch( $child->attributeValue( "object_id" ) );
+                // Only support objects of image class for now
+                $object = eZContentObject::fetch( $objectID );
                 if ( $object && $object->canRead() )
                 {
-
                     $classIdentifier = $object->attribute( "class_identifier" );
 
                     // Todo: read class identifiers from configuration
                     if ( $classIdentifier == "image" )
                     {
-                        $imageSize = $child->attributeValue( 'size' );
-                        $imageAlignment = $child->attributeValue( 'align' );
+                        $imageSize = $child->getAttribute( 'size' );
+                        $imageAlignment = $child->getAttribute( 'align' );
 
                         $dataMap = $object->dataMap();
                         $imageAttribute = $dataMap['image'];
@@ -665,22 +470,18 @@
                 }
                 else
                 {
-                    eZDebug::writeError( "Image (object_id = " . $child->attributeValue( 'object_id' ) . " ) could not be used (does not exist or insufficient privileges)");
+                    eZDebug::writeError( "Image (object_id = " . $child->getAttribute( 'object_id' ) . " ) could not be used (does not exist or insufficient privileges)");
                 }
-            }break;
+            } break;
 
             default:
             {
-                eZDebug::writeError( "Unsupported node at this level" . $child->name() );
-
-            }break;
-
+                eZDebug::writeError( "Unsupported node at this level" . $child->localName );
+            }
         }
 
-
         return array ( "paragraph_parameters" => $paragraphParameters,
                        "image_array" =>  $imageArray );
-
     }
 }
 
Index: modules/ezodf/ezoogenerator.php
===================================================================
--- modules/ezodf/ezoogenerator.php	(revision 3273)
+++ modules/ezodf/ezoogenerator.php	(working copy)
@@ -31,8 +31,6 @@
 /*! \file ezoogenerator.php
 */
 
-include_once( "lib/ezfile/classes/ezfilehandler.php" );
-
 /*!
   \class eZOOGenerator ezoogenerator.php
   \brief The class eZOOGenerator does
@@ -61,13 +59,10 @@
         $ooINI = eZINI::instance( 'odf.ini' );
 
         // Initalize directories
-        include_once( "lib/ezfile/classes/ezdir.php" );
         eZDir::mkdir( $this->OORootDir );
-        eZDir::mkdir( $this->OOExportDir );
-        eZDir::mkdir( $this->OOExportDir . "/META-INF" );
+        eZDir::mkdir( $this->OOExportDir . "META-INF", false, true );
         eZDir::mkdir( $this->OOTemplateDir );
 
-        // Write meta XML file
         $metaXML = "<?xml version='1.0' encoding='UTF-8'?>" .
                    "<office:document-meta xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:meta='urn:oasis:names:tc:opendocument:xmlns:meta:1.0' xmlns:ooo='http://openoffice.org/2004/office' office:version='1.0' xmlns:ezpublish='http://www.ez.no/ezpublish/oasis'>" .
                      "<office:meta>" .
@@ -85,27 +80,18 @@
                      " </office:meta>" .
                      "</office:document-meta>";
 
-        $fileName = $this->OOExportDir . "meta.xml";
-        $fp = fopen( $fileName, "w" );
-        fwrite( $fp, $metaXML );
-        fclose( $fp );
+        file_put_contents( $this->OOExportDir . "meta.xml", $metaXML );
 
-        // Write settings XML file
-
         $settingsXML = "<?xml version='1.0' encoding='UTF-8'?>" .
                        "<office:document-settings xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:config='urn:oasis:names:tc:opendocument:xmlns:config:1.0' xmlns:ooo='http://openoffice.org/2004/office' office:version='1.0'>" .
                        "  <office:settings>" .
                        " </office:settings>" .
                        "</office:document-settings>";
+        file_put_contents( $this->OOExportDir . "settings.xml", $settingsXML );
 
-        $fileName = $this->OOExportDir . "settings.xml";
-        $fp = fopen( $fileName, "w" );
-        fwrite( $fp, $settingsXML );
-        fclose( $fp );
-
         $useTemplate = ( $ooINI->variable( 'ODFExport', 'UseTemplate' ) == "true" );
         $templateName = $ooINI->variable( 'ODFExport', 'TemplateName' );
-        if ( $useTemplate == true )
+        if ( $useTemplate )
         {
             $templateFile = "extension/ezodf/templates/" . $templateName;
             // Check if zlib extension is loaded, if it's loaded use bundled ZIP library,
@@ -169,21 +155,12 @@
                  "  </office:styles>" .
                  "</office:document-styles>";
 
-            $fileName = $this->OOExportDir . "styles.xml";
-            $fp = fopen( $fileName, "w" );
-            fwrite( $fp, $stylesXML );
-            fclose( $fp );
+            file_put_contents( $this->OOExportDir . "styles.xml", $stylesXML );
         }
 
-
-        // Write mimetype file
         $mimeType = "application/vnd.oasis.opendocument.text";
+        file_put_contents( $this->OOExportDir . "mimetype", $mimeType );
 
-        $fileName = $this->OOExportDir . "mimetype";
-        $fp = fopen( $fileName, "w" );
-        fwrite( $fp, $mimeType );
-        fclose( $fp );
-
         // Write content XML file
         $contentXML = "<?xml version='1.0' encoding='UTF-8'?>" .
              "<!DOCTYPE office:document-content PUBLIC '-//OpenOffice.org//DTD OfficeDocument1.0//EN' 'office.dtd'>" .
@@ -266,10 +243,7 @@
         // Add the content end
         $contentXML .= "</office:text></office:body></office:document-content>";
 
-        $fileName = $this->OOExportDir . "content.xml";
-        $fp = fopen( $fileName, "w" );
-        fwrite( $fp, $contentXML );
-        fclose( $fp );
+        file_put_contents( $this->OOExportDir . "content.xml", $contentXML );
 
         // Write the manifest file
         $manifestXML = "<?xml version='1.0' encoding='UTF-8'?>" .
@@ -293,10 +267,7 @@
         }
         $manifestXML .= "</manifest:manifest>";
 
-        $fileName = $this->OOExportDir . "META-INF/manifest.xml";
-        $fp = fopen( $fileName, "w" );
-        fwrite( $fp, $manifestXML );
-        fclose( $fp );
+        file_put_contents( $this->OOExportDir . "META-INF/manifest.xml", $manifestXML );
 
         // Check if zlib extension is loaded, if it's loaded use bundled ZIP library,
         // if not rely on the zip commandline version.
@@ -322,7 +293,6 @@
 
         $fileName = $this->OORootDir . "ootest.odt";
 
-
         // Clean up
         eZDir::recursiveDelete( $this->OOExportDir );
         eZDir::recursiveDelete( $this->OOTemplateDir);
@@ -342,12 +312,13 @@
     /*!
       Adds a new paragraph to the document
     */
-    function addParagraph( )
+    function addParagraph()
     {
         $style = "";
+        $numArgs = func_num_args();
         $argArray = func_get_args();
 
-        if ( func_num_args() > 1 )
+        if ( $numArgs > 1 )
         {
             // Check for style definition
             if ( !is_array( $argArray[0] ) )
@@ -357,7 +328,7 @@
             }
         }
 
-        if ( func_num_args() > 0 and ( is_array( $argArray[0] ) ) )
+        if ( $numArgs > 0 and is_array( $argArray[0] ) )
         {
             $paragraphArray = array();
 
@@ -376,7 +347,7 @@
                         $tagContent = str_replace( '"', "&quot;", $tagContent );
 
                         $paragraphArray[] = array( 'Type' => 'text', "Content" => $tagContent );
-                    }break;
+                    } break;
 
                     case self::STYLE_START:
                     {
@@ -388,31 +359,35 @@
                         if ( substr( $paragraphElement[1], 0, 18 ) == "eZCustominline_20_" )
                             $paragraphArray[] = array( 'Type' => 'custom_inline_start', 'Name' => $paragraphElement[1] );
 
-                    }break;
+                    } break;
 
                     case self::STYLE_STOP:
                     {
                         $paragraphArray[] = array( 'Type' => 'style_stop' );
-                    }break;
+                    } break;
 
                     case self::LINK:
                     {
                         $paragraphArray[] = array( 'Type' => 'link',
                                                    "Content" => $content = $paragraphElement[2],
                                                    "HREF" => $paragraphElement[1] );
-                    }break;
+                    } break;
 
                     default:
                     {
                         eZDebug::writeError( "Unknown paragraph element." );
-                    }break;
+                    } break;
                 }
             }
         }
-        else
+        else if ( $numArgs > 0 )
         {
             $paragraphArray = array( array( 'Type' => 'text', "Content" => $argArray[0] ) );
         }
+        else
+        {
+            $paragraphArray = array( array( 'Type' => 'text', "Content" => '' ) );
+        }
 
         $elementArray = array( 'Type' => 'paragraph',
                                'Style' => $style,
@@ -444,7 +419,7 @@
                 // Add the paragraph inside a table cell
                 $currentRow = $this->DocumentStack[$this->CurrentStackNumber]['CurrentRow'];
                 $currentCell = $this->DocumentStack[$this->CurrentStackNumber]['CurrentCell'];
-                if ( is_numeric( $this->DocumentStack[$this->CurrentStackNumber]['CurrentColSpan'] ) )
+                if ( isset( $this->DocumentStack[$this->CurrentStackNumber]['CurrentColSpan'] ) && is_numeric( $this->DocumentStack[$this->CurrentStackNumber]['CurrentColSpan'] ) )
                     $elementArray = array_merge( $elementArray, array( "ColSpan" => $this->DocumentStack[$this->CurrentStackNumber]['CurrentColSpan'] ) );
                 $this->DocumentStack[$this->CurrentStackNumber]['ChildArray'][$currentRow][$currentCell][] = $elementArray;
 
@@ -470,7 +445,7 @@
       Starts an un-ordered or numbered list sequence. The $type parameter can either be the string
       unordered or ordered.
     */
-    function startList( $type="unordered" )
+    function startList( $type = "unordered" )
     {
         $this->CurrentStackNumber += 1;
         $this->DocumentStack[$this->CurrentStackNumber]['Type'] = 'list';
@@ -699,15 +674,15 @@
             {
                 $uniquePart = substr( md5( time() . rand( 0, 20000 ) ), 6 );
                 $fileName = $element['SRC'];
-                $destFile = $this->OOExportDir . "Pictures/" . $uniquePart . basename( $fileName );
                 $relativeFile = "Pictures/" . $uniquePart . basename( $fileName );
+                $destFile = $this->OOExportDir . $relativeFile;
 
                 if ( copy( $fileName, $destFile ) )
                 {
                     $realFileName = $destFile;
                     $sizeArray = getimagesize( $destFile );
 
-                    $this->ImageFileArray[] = "Pictures/" . $uniquePart . basename( $fileName );
+                    $this->ImageFileArray[] = $relativeFile;
                     $widthRatio = ( $element['DisplayWidth'] / 580 ) * 100;
 
                     // If image is larger than 300 px make it full page, or pixelsize
@@ -800,7 +775,7 @@
                         foreach ( $cellArray as $cellElement )
                         {
                             // Check for colspan
-                            if ( is_numeric( $cellElement['ColSpan'] ) )
+                            if ( isset( $cellElement['ColSpan'] ) && is_numeric( $cellElement['ColSpan'] ) )
                             {
                                 $colSpan = $cellElement['ColSpan'];
                                 // Increase cell count with 1-colspan
@@ -833,7 +808,7 @@
                 $numberLetter = "A";
                 $numberOfColumns = $columnCount;
 
-                $columnDefinition .= "<table:table-column table:style-name='Table$tableCounter.$numberLetter' table:number-columns-repeated='$numberOfColumns' />\n";
+                $columnDefinition = "<table:table-column table:style-name='Table$tableCounter.$numberLetter' table:number-columns-repeated='$numberOfColumns' />\n";
 
                 $contentXML .= "<table:table table:name='Table$tableCounter' table:style-name='Table$tableCounter'>\n" . $columnDefinition . $rowContent . "</table:table>";
 
Index: modules/ezodf/ezooimport.php
===================================================================
--- modules/ezodf/ezooimport.php	(revision 3273)
+++ modules/ezodf/ezooimport.php	(working copy)
@@ -37,10 +37,6 @@
 
 */
 
-include_once( 'lib/ezxml/classes/ezxml.php' );
-include_once( 'lib/ezlocale/classes/ezdatetime.php' );
-include_once( 'lib/ezfile/classes/ezdir.php' );
-
 class eZOOImport
 {
     const ERROR_NOERROR = 0;
@@ -60,6 +56,14 @@
     const ERROR_UNKNOWNCLASS = 14;
     const ERROR_UNKNOWN = 127;
 
+    const NAMESPACE_OFFICE = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0';
+    const NAMESPACE_TEXT = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0';
+    const NAMESPACE_STYLE = 'urn:oasis:names:tc:opendocument:xmlns:style:1.0';
+    const NAMESPACE_TABLE = 'urn:oasis:names:tc:opendocument:xmlns:table:1.0';
+    const NAMESPACE_DRAWING = 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0';
+    const NAMESPACE_SVG_COMPATIBLE = 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0';
+    const NAMESPACE_XLINK = 'http://www.w3.org/1999/xlink';
+
     var $ERROR = array();
     var $currentUserID;
 
@@ -97,67 +101,46 @@
     */
     function setError( $errorNumber = 0, $errorDescription = "" )
     {
+        $this->ERROR['number'] = $errorNumber;
+        $this->ERROR['description'] = $errorDescription;
+
         switch( $errorNumber )
         {
             case self::ERROR_NOERROR :
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = "";
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_UNSUPPORTEDTYPE :
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "File extension or type is not allowed." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_PARSEXML :
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Could not parse XML." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_OPENSOCKET :
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Can not open socket. Please check if extension/ezodf/daemon.php is running." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_CONVERT :
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Can not convert the given document." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_DAEMONCALL :
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Unable to call daemon. Fork can not create child process." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_DAEMON :
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Daemon reported error." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_UNKNOWNNODE:
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Unknown node." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_ACCESSDENIED:
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Access denied." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_IMPORTING:
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Error during import." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             case self::ERROR_UNKNOWNCLASS:
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Unknown content class specified in odf.ini:" );
-                $this->ERROR['description'] = $errorDescription;
                 break;
             default :
-                $this->ERROR['number'] = $errorNumber;
                 $this->ERROR['value'] = ezi18n( 'extension/ezodf/import/error', "Unknown error." );
-                $this->ERROR['description'] = $errorDescription;
                 break;
         }
     }
@@ -253,7 +236,6 @@
              $GLOBALS["OOImportObjectID"] = $placeNodeID;
 
         // Check if we have access to node
-        include_once( 'kernel/content/ezcontentfunctioncollection.php' );
         $place_node = eZContentObjectTreeNode::fetch( $placeNodeID );
 
         $importClassIdentifier = $ooINI->variable( 'ODFImport', 'DefaultImportClass' );
@@ -280,7 +262,7 @@
 
             if ( $locationOK === false || $locationOK === null )
             {
-                $this->setError( self::ERROR_UNKNOWNNODE, ezi18n( 'extension/ezodf/import/error',"Unable to fetch node with id  ") . $placeNodeID );
+                $this->setError( self::ERROR_UNKNOWNNODE, ezi18n( 'extension/ezodf/import/error', "Unable to fetch node with id ") . $placeNodeID );
                 return false;
             }
 
@@ -331,7 +313,6 @@
         }
 
         $importResult = array();
-        include_once( "lib/ezfile/classes/ezdir.php" );
         $unzipResult = "";
         $uniqueImportDir = $this->ImportDir;
         // Need to create the directory in two steps. On Mac the recursive dir creation did not work
@@ -348,14 +329,13 @@
         }
         else
         {
-            require_once('extension/ezodf/lib/pclzip.lib.php');
             $archive = new PclZip( $file );
             $archive->extract( PCLZIP_OPT_PATH, $uniqueImportDir );
         }
 
         $fileName = $uniqueImportDir . "content.xml";
-        $xml = new eZXML();
-        $dom = $xml->domTree( file_get_contents( $fileName ) );
+        $dom = new DOMDocument( '1.0', 'UTF-8' );
+        $success = $dom->load( $fileName );
         $sectionNodeHash = array();
 
         // At this point we could unlink the destination file from the conversion, if conversion was used
@@ -364,7 +344,7 @@
             unlink( $tmpToFile );
         }
 
-        if ( !is_object( $dom ) )
+        if ( !$success )
         {
             $this->setError( self::ERROR_PARSEXML );
             return false;
@@ -372,17 +352,17 @@
 
 
         // Fetch the automatic document styles
-        $automaticStyleArray = $dom->elementsByNameNS( 'automatic-styles', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0' );
-        if ( count( $automaticStyleArray ) == 1 )
+        $automaticStyleArray = $dom->getElementsByTagNameNS( self::NAMESPACE_OFFICE, 'automatic-styles' );
+        if ( $automaticStyleArray->length == 1 )
         {
-            $this->AutomaticStyles = $automaticStyleArray[0]->children();
+            $this->AutomaticStyles = $automaticStyleArray->item( 0 )->childNodes;
         }
 
         // Fetch the body section content
-        $sectionNodeArray = $dom->elementsByNameNS( 'section', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' );
+        $sectionNodeArray = $dom->getElementsByTagNameNS( self::NAMESPACE_TEXT, 'section' );
 
         $customClassFound = false;
-        if ( count( $sectionNodeArray ) > 0 )
+        if ( $sectionNodeArray->length > 0 )
         {
             $registeredClassArray = $ooINI->variable( 'ODFImport', 'RegisteredClassArray' );
 
@@ -390,7 +370,7 @@
             $sectionNameArray = array();
             foreach ( $sectionNodeArray as $sectionNode )
             {
-                $sectionNameArray[] = strtolower( $sectionNode->attributeValueNS( "name", "urn:oasis:names:tc:opendocument:xmlns:text:1.0" ) );
+                $sectionNameArray[] = strtolower( $sectionNode->getAttributeNS( "urn:oasis:names:tc:opendocument:xmlns:text:1.0", "name" ) );
             }
 
             // Check if there is a coresponding eZ Publish class for this document
@@ -423,20 +403,19 @@
             {
                 foreach ( $sectionNodeArray as $sectionNode )
                 {
-                    $sectionName = str_replace( " ", "_", strtolower( $sectionNode->attributeValueNS( 'name', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' ) ) );
+                    $sectionName = str_replace( " ", "_", strtolower( $sectionNode->getAttributeNS( self::NAMESPACE_TEXT, 'name' ) ) );
                     $xmlText = "";
                     $level = 1;
-                    $childArray = $sectionNode->children();
+                    $childArray = $sectionNode->childNodes;
                     $nodeCount = 1;
                     foreach ( $childArray as $childNode )
                     {
-                        $isLastTag = false;
-                        if ( $nodeCount == count( $childArray ) )
+                        if ( $childNode->nodeType === XML_ELEMENT_NODE )
                         {
-                            $isLastTag = true;
+                            $isLastTag = ( $nodeCount == $childArray->length );
+                            $xmlText .= eZOOImport::handleNode( $childNode, $level, $isLastTag );
                         }
 
-                        $xmlText .= eZOOImport::handleNode( $childNode, $level, $isLastTag );
                         $nodeCount++;
                     }
                     $endSectionPart = "";
@@ -458,13 +437,13 @@
         if ( $customClassFound == false )
         {
             // No defined sections. Do default import.
-            $bodyNodeArray = $dom->elementsByNameNS( 'text', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0' );
+            $bodyNodeArray = $dom->getElementsByTagNameNS( self::NAMESPACE_OFFICE, 'text' );
 
-            if ( count( $bodyNodeArray ) == 1 )
+            if ( $bodyNodeArray->length == 1 )
             {
                 $xmlText = "";
                 $level = 1;
-                foreach ( $bodyNodeArray[0]->children() as $childNode )
+                foreach ( $bodyNodeArray->item( 0 )->childNodes as $childNode )
                 {
                     $xmlText .= eZOOImport::handleNode( $childNode, $level );
                 }
@@ -557,8 +536,9 @@
                         case "ezstring":
                         case "eztext":
                         {
-                            $dom = $xml->domTree( $xmlTextArray[$sectionName] );
-                            $text = eZOOImport::domToText( $dom->root() );
+                            $eztextDom = new DOMDOcument( '1.0', 'UTF-8' );
+                            $eztextDom->loadXML( $xmlTextArray[$sectionName] );
+                            $text = $eztextDom->documentElement->textContent;
                             $dataMap[$attributeIdentifier]->setAttribute( 'data_text', trim( $text ) );
                             $dataMap[$attributeIdentifier]->store();
                         }break;
@@ -605,23 +585,22 @@
                             $dateArray = explode( "/", $dateTimeArray[0] );
                             $timeArray = explode( ":", $dateTimeArray[1] );
 
-
                             if ( count( $dateArray ) == 3 and count( $timeArray ) == 2 )
                             {
-                                    $year = $dateArray[2];
-                                    $month = $dateArray[1];
-                                    $day = $dateArray[0];
+                                $year = $dateArray[2];
+                                $month = $dateArray[1];
+                                $day = $dateArray[0];
 
-                                    $hour = $timeArray[0];
-                                    $minute = $timeArray[1];
+                                $hour = $timeArray[0];
+                                $minute = $timeArray[1];
 
-                                    $dateTime = new eZDateTime();
+                                $dateTime = new eZDateTime();
 
-                                    $contentClassAttribute = $dataMap[$attributeIdentifier];
+                                $contentClassAttribute = $dataMap[$attributeIdentifier];
 
-                                    $dateTime->setMDYHMS( $month, $day, $year, $hour, $minute, 0 );
-                                    $dataMap[$attributeIdentifier]->setAttribute( 'data_int', $dateTime->timeStamp()  );
-                                    $dataMap[$attributeIdentifier]->store();
+                                $dateTime->setMDYHMS( $month, $day, $year, $hour, $minute, 0 );
+                                $dataMap[$attributeIdentifier]->setAttribute( 'data_int', $dateTime->timeStamp()  );
+                                $dataMap[$attributeIdentifier]->store();
                             }
                         }break;
 
@@ -634,18 +613,18 @@
                             if ( is_object( $sectionNodeHash[$sectionName] ) )
                             {
                                 // Look for paragraphs in the section
-                                foreach ( $sectionNodeHash[$sectionName]->children() as $paragraph )
+                                foreach ( $sectionNodeHash[$sectionName]->childNodes as $paragraph )
                                 {
                                     // Look for frame node
-                                    foreach ( $paragraph->children() as $frame )
+                                    foreach ( $paragraph->childNodes as $frame )
                                     {
                                         // finally look for the image node
-                                        $children = $frame->children();
+                                        $children = $frame->childNodes;
 
-                                        if ( $children[0]->name() == "image" )
+                                        if ( $children->item( 0 )->localName == "image" )
                                         {
-                                            $imageNode = $children[0];
-                                            $fileName = $imageNode->attributeValue( "href" );
+                                            $imageNode = $children->item( 0 );
+                                            $fileName = $imageNode->getAttribute( "href" );
 
                                             $filePath = $this->ImportDir . $fileName;
 
@@ -693,28 +672,28 @@
                             if ( is_object( $sectionNodeHash[$sectionName] ) )
                             {
                                 // Look for paragraphs in the section
-                                foreach ( $sectionNodeHash[$sectionName]->children() as $table )
+                                foreach ( $sectionNodeHash[$sectionName]->childNodes as $table )
                                 {
-                                    if ( $table->name() == "table" )
+                                    if ( $table->localName == "table" )
                                     {
                                         // Loop the rows in the table
-                                        foreach ( $table->children() as $row )
+                                        foreach ( $table->childNodes as $row )
                                         {
                                             // Check the headers and compare with the defined matrix
-                                            if ( $row->name() == "table-header-rows" )
+                                            if ( $row->localName == "table-header-rows" )
                                             {
-                                                $rowArray = $row->children();
-                                                if ( count( $rowArray ) == 1  )
+                                                $rowArray = $row->childNodes;
+                                                if ( $rowArray->length == 1  )
                                                 {
-                                                    foreach ( $rowArray[0]->children() as $headerCell )
+                                                    foreach ( $rowArray->item( 0 )->childNodes as $headerCell )
                                                     {
-                                                        if ( $headerCell->name() == "table-cell" )
+                                                        if ( $headerCell->localName == "table-cell" )
                                                         {
-                                                            $paragraphArray = $headerCell->children();
+                                                            $paragraphArray = $headerCell->childNodes;
 
-                                                            if ( count( $paragraphArray ) == 1 )
+                                                            if ( $paragraphArray->length == 1 )
                                                             {
-                                                                $headerName = $paragraphArray[0]->textContent();
+                                                                $headerName = $paragraphArray->item( 0 )->textContent;
                                                                 if ( $matrixHeaderArray[$headerCount] != $headerName )
                                                                 {
                                                                     $headersValid = false;
@@ -727,18 +706,14 @@
                                             }
 
                                             // Check the rows
-                                            if ( $row->name() == "table-row" )
+                                            if ( $row->localName == "table-row" )
                                             {
-                                                foreach ( $row->children() as $cell )
+                                                foreach ( $row->childNodes as $cell )
                                                 {
-                                                    if ( count( $cell->children() ) >= 1 )
+                                                    if ( $cell->childNodes->length >= 1 )
                                                     {
-                                                        $firstParagraph = $cell->children();
-                                                        $firstParagraph = $firstParagraph[0];
-                                                        $cellContent = $firstParagraph->textContent();
-
-                                                        $cellArray[] = $cellContent;
-
+                                                        $firstParagraph = $cell->childNodes->item( 0 );
+                                                        $cellArray[] = $firstParagraph->textContent;
                                                     }
                                                 }
                                                 $rowCount++;
@@ -787,7 +762,7 @@
                     $bodyAttribute = $ooINI->variable( $importClassIdentifier, 'DefaultImportBodyAttribute' );
                 }
 
-                $objectName = basename( $originalFileName);
+                $objectName = basename( $originalFileName );
 
                 // Remove extension from name
                 $objectName = preg_replace( "/(\....)$/", "", $objectName );
@@ -801,7 +776,6 @@
                 $dataMap[$bodyAttribute]->store();
             }
 
-            include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
             $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
                                                                                          'version' => $version->attribute( 'version' ) ) );
 
@@ -845,7 +819,6 @@
                                                              );
                 $nodeAssignment->store();
 
-                include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
                 $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $image['ID'],
                                                                                              'version' => 1 ) );
 
@@ -868,7 +841,7 @@
 
 
     /*!
-      Handless DOM node in the OpenOffice.org writer docuemnt and returns the eZXMLText equivalent.
+      Handless DOM node in the OpenOffice.org writer document and returns the eZXMLText equivalent.
       If images are embedded in the document they will be imported as media objects in eZ Publish.
      */
     function handleNode( $node, &$sectionLevel, $isLastTag = false )
@@ -878,7 +851,7 @@
         {
 
             // If another tag than paragraph comes then terminate collapsing tags, if any
-            if ( $node->name() != "p" and $this->CollapsingTagName != false )
+            if ( $node->localName != "p" and $this->CollapsingTagName != false )
             {
                 $xhtmlTextContent .= '<paragraph>' . '<' . $this->CollapsingTagName . ' ' . $this->CollapsingTagAttribute . ' >' . $this->CollapsingTagContent . "</" . $this->CollapsingTagName . ">\n</paragraph>\n";
                 $this->CollapsingTagContent = false;
@@ -886,7 +859,7 @@
                 $this->CollapsingTagName = false;
             }
 
-            switch ( $node->name() )
+            switch ( $node->localName )
             {
                 case 'sequence-decls' :
                 case 'forms' :
@@ -897,7 +870,7 @@
 
                 case 'section' :
                 {
-                    foreach ( $node->children() as $childNode )
+                    foreach ( $node->childNodes as $childNode )
                     {
                         $xhtmlTextContent  .= eZOOImport::handleNode( $childNode, $sectionLevel );
                     }
@@ -905,7 +878,7 @@
 
                 case 'h' :
                 {
-                    $level = $node->attributeValueNS( 'outline-level', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' );
+                    $level = $node->getAttributeNS( self::NAMESPACE_TEXT, 'outline-level' );
 
                     if ( $level > 6 )
                         $level = 6;
@@ -915,7 +888,7 @@
                         $levelDiff = $level - $sectionLevel;
                         $sectionLevel = $level;
                         $headerContent = "";
-                        foreach ( $node->children() as $childNode )
+                        foreach ( $node->childNodes as $childNode )
                         {
                             $headerContent .= eZOOImport::handleInlineNode( $childNode );
                         }
@@ -931,13 +904,13 @@
                     }
                     else
                     {
-                        eZDebug::writeError( "Unsupported header level $level<br>" . $node->textContent() . "<br>" );
+                        eZDebug::writeError( "Unsupported header level $level<br>" . $node->textContent . "<br>" );
                     }
                 }break;
 
                 case 'p' :
                 {
-                    $styleName = $node->attributeValueNS( 'style-name', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' );
+                    $styleName = $node->getAttributeNS( self::NAMESPACE_TEXT, 'style-name' );
 
                     $lastCollapsingTagName = $this->CollapsingTagName;
 
@@ -971,24 +944,19 @@
                     $headerLevel = false;
                     foreach ( $this->AutomaticStyles as $style )
                     {
-                        $tmpStyleName = $style->attributeValueNS( "name", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
+                        $tmpStyleName = $style->getAttributeNS( self::NAMESPACE_STYLE, "name" );
 
                         if ( $styleName == $tmpStyleName )
                         {
-                            if ( count( $style->children() >= 1 ) )
+                            foreach ( $style->childNodes as $styleChild )
                             {
-                                $children = $style->children();
-
-                                foreach ( $children as $styleChild )
-                                {
-                                    $fontWeight = $styleChild->attributeValue( 'font-weight' );
-                                    $fontStyle = $styleChild->attributeValue( 'font-style' );
-                                }
+                                $fontWeight = $styleChild->getAttribute( 'font-weight' );
+                                $fontStyle = $styleChild->getAttribute( 'font-style' );
                             }
 
                             // Get the parent style name, it's used to see if it's a
                             // header which comes from Word conversion
-                            $parentStyleName = $style->attributeValueNS( "parent-style-name", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
+                            $parentStyleName = $style->getAttributeNS( "parent-style-name" );
 
                             // Check if we've got a header definition and which level Heading_20
                             // Header styles is either defined in style-name or parent-style-name when
@@ -1011,7 +979,6 @@
                             $headerLevel = $level;
                     }
 
-
                     $preStyles = "";
                     if ( $fontWeight == "bold" )
                         $preStyles .= "<strong>";
@@ -1025,12 +992,11 @@
                         $postStyles .= "</strong>";
 
                     $paragraphContent = "";
-                    foreach ( $node->children() as $childNode )
+                    foreach ( $node->childNodes as $childNode )
                     {
                         $paragraphContent .= eZOOImport::handleInlineNode( $childNode );
                     }
 
-
                     // If current paragraph is actually a header, then skip sub-formatting
                     if ( $headerLevel !== false )
                     {
@@ -1111,9 +1077,9 @@
                 case 'numbered-paragraph' :
                 {
                     $listContent = "";
-                    foreach ( $node->children() as $itemNode )
+                    foreach ( $node->childNodes as $itemNode )
                     {
-                        if ( $itemNode->name() == 'p' )
+                        if ( $itemNode->localName == 'p' )
                         {
                             $listContent .= "<li>" . strip_tags( eZOOImport::handleNode( $itemNode, $sectionLevel ) ) . "</li>";
                         }
@@ -1124,30 +1090,33 @@
 
                 case 'list' :
                 {
-                    $styleName = $node->attributeValueNS( 'style-name', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' );
+                    $styleName = $node->getAttributeNS( self::NAMESPACE_TEXT, 'style-name' );
 
                     // Check list style for unordered/ordered list
                     $listType = false;
                     foreach ( $this->AutomaticStyles as $style )
                     {
-                        $tmpStyleName = $style->attributeValueNS( "name", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
+                        $tmpStyleName = $style->getAttributeNS( self::NAMESPACE_STYLE, "name" );
 
                         if ( $styleName == $tmpStyleName )
                         {
-                            if ( count( $style->children() >= 1 ) )
+                            if ( $style->childNodes->length >= 1 )
                             {
-                                $children = $style->children();
+                                $children = $style->childNodes;
 
-                                if ( $children[0]->name() == "list-level-style-number" )
+                                switch ( $children->item( 0 )->localName )
                                 {
-                                    $listType = "ordered";
-                                    $this->InsideListType = "ordered";
-                                }
+                                    case "list-level-style-number":
+                                    {
+                                        $listType = "ordered";
+                                        $this->InsideListType = "ordered";
+                                    } break;
 
-                                if ( $children[0]->name() == "list-level-style-bullet" )
-                                {
-                                    $listType = "unordered";
-                                    $this->InsideListType = "unordered";
+                                    case "list-level-style-bullet":
+                                    {
+                                        $listType = "unordered";
+                                        $this->InsideListType = "unordered";
+                                    } break;
                                 }
                             }
                         }
@@ -1161,11 +1130,11 @@
 
                     $isSubList = $this->IsSubList;
                     $this->IsSubList = true;
-                    foreach ( $node->children() as $itemNode )
+                    foreach ( $node->childNodes as $itemNode )
                     {
-                        if ( $itemNode->name() == 'list-item' )
+                        if ( $itemNode->localName == 'list-item' )
                         {
-                            foreach ( $itemNode->children() as $childNode )
+                            foreach ( $itemNode->childNodes as $childNode )
                             {
                                 $listItemContent = eZOOImport::handleNode( $childNode, $sectionLevel );
 
@@ -1214,23 +1183,23 @@
                 case 'table' :
                 {
                     $tableContent = "";
-                    foreach ( $node->children() as $itemNode )
+                    foreach ( $node->childNodes as $itemNode )
                     {
-                        if ( $itemNode->name() == 'table-header-rows' )
+                        if ( $itemNode->localName == 'table-header-rows' )
                         {
-                            foreach ( $itemNode->children() as $headerRow )
+                            foreach ( $itemNode->childNodes as $headerRow )
                             {
-                                if ( $headerRow->name() == 'table-row' )
+                                if ( $headerRow->localName == 'table-row' )
                                 {
                                     $rowContent = "";
-                                    foreach ( $headerRow->children() as $tableCell )
+                                    foreach ( $headerRow->childNodes as $tableCell )
                                     {
-                                        $colSpan = $tableCell->attributeValueNS( 'number-columns-spanned', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0' );
+                                        $colSpan = $tableCell->getAttributeNS( self::NAMESPACE_TABLE, 'number-columns-spanned' );
 
-                                        if ( $tableCell->name() == 'table-cell' )
+                                        if ( $tableCell->localName == 'table-cell' )
                                         {
                                             $cellContent = "";
-                                            foreach ( $tableCell->children() as $tableContentNode )
+                                            foreach ( $tableCell->childNodes as $tableContentNode )
                                             {
                                                 $cellContent .= eZOOImport::handleNode( $tableContentNode, $sectionLevel );
                                             }
@@ -1246,16 +1215,16 @@
                                 }
                             }
                         }
-                        else if ( $itemNode->name() == 'table-row' )
+                        else if ( $itemNode->localName == 'table-row' )
                         {
                             $rowContent = "";
-                            foreach ( $itemNode->children() as $tableCell )
+                            foreach ( $itemNode->childNodes as $tableCell )
                             {
-                                if ( $tableCell->name() == 'table-cell' )
+                                if ( $tableCell->localName == 'table-cell' )
                                 {
                                     $cellContent = "";
-                                    $colSpan = $tableCell->attributeValueNS( 'number-columns-spanned', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0' );
-                                    foreach ( $tableCell->children() as $tableContentNode )
+                                    $colSpan = $tableCell->getAttributeNS( self::NAMESPACE_TABLE, 'number-columns-spanned' );
+                                    foreach ( $tableCell->childNodes as $tableContentNode )
                                     {
                                         $cellContent .= eZOOImport::handleNode( $tableContentNode, $sectionLevel );
                                     }
@@ -1269,8 +1238,6 @@
                             }
                             $tableContent .= "<tr>" . $rowContent . "</tr>";
                         }
-
-
                     }
                     $xhtmlTextContent .= "<paragraph><table width='100%'>" . $tableContent . "</table></paragraph>";
                 }break;
@@ -1278,7 +1245,7 @@
 
                 default:
                 {
-                    eZDebug::writeError( "Unsupported top node " . $node->name() . "<br/>" );
+                    eZDebug::writeError( "Unsupported top node " . $node->localName . "<br/>" );
                 }break;
             }
         }
@@ -1291,19 +1258,18 @@
     function handleInlineNode( $childNode )
     {
         $paragraphContent = "";
-        switch ( $childNode->name() )
+        switch ( $childNode->localName )
         {
             case "frame":
             {
                 $frameContent = "";
-                foreach ( $childNode->children() as $imageNode )
+                foreach ( $childNode->childNodes as $imageNode )
                 {
-                    switch ( $imageNode->name() )
+                    switch ( $imageNode->localName )
                     {
-
                         case "image" :
                         {
-                            $href = ltrim( $imageNode->attributeValueNS( 'href', 'http://www.w3.org/1999/xlink' ), '#' );
+                            $href = ltrim( $imageNode->getAttributeNS( self::NAMESPACE_XLINK, 'href' ), '#' );
 
                             if ( 0 < preg_match( '@^(?:http://)([^/]+)@i', $href ) ) //if image is specified with url
                             {
@@ -1334,7 +1300,7 @@
                                 $href = $this->ImportDir . $href;
 
                             // Check image name
-                            $imageName = $childNode->attributeValueNS( 'name', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0' );
+                            $imageName = $childNode->getAttributeNS( self::NAMESPACE_DRAWING, 'name' );
                             if ( !$imageName )
                             {
                                 // set default image name
@@ -1348,7 +1314,7 @@
                             // Check image size
                             $imageSize = "large";
                             $pageWidth = 6;
-                            $width = $childNode->attributeValueNS( 'width', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0' );
+                            $width = $childNode->getAttributeNS( self::NAMESPACE_SVG_COMPATIBLE, 'width' );
 
                             $sizePercentage = $width / $pageWidth * 100;
 
@@ -1363,21 +1329,20 @@
                             if ( $imageSize != "small" and $sizeArray[0] < 650 )
                                 $imageSize = "original";
 
-                            $styleName = $childNode->attributeValueNS( 'style-name', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0' );
+                            $styleName = $childNode->getAttributeNS( self::NAMESPACE_DRAWING, 'style-name' );
 
                             // Check for style definitions
                             $imageAlignment = "center";
                             foreach ( $this->AutomaticStyles as $style )
                             {
-                                $tmpStyleName = $style->attributeValueNS( "name", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
+                                $tmpStyleName = $style->getAttributeNS( self::NAMESPACE_STYLE, "name" );
 
                                 if ( $styleName == $tmpStyleName )
                                 {
-                                    if ( count( $style->children() == 1 ) )
+                                    if ( $style->childNodes->length == 1 )
                                     {
-                                        $children = $style->children();
-                                        $properties = $children[0];
-                                        $alignment = $properties->attributeValueNS( "horizontal-pos", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
+                                        $properties = $style->childNodes->item( 0 );
+                                        $alignment = $properties->getAttributeNS( self::NAMESPACE_STYLE, "horizontal-pos" );
                                     }
 
                                     // Check image alignment
@@ -1506,7 +1471,7 @@
 
             case "text-box":
             {
-                foreach ( $childNode->children() as $textBoxNode )
+                foreach ( $childNode->childNodes as $textBoxNode )
                 {
                     $boxContent .= eZOOImport::handleNode( $textBoxNode, $sectionLevel );
                 }
@@ -1515,21 +1480,13 @@
                 $paragraphContent .= "</paragraph>$boxContent<paragraph>";
             }break;
 
-            case "sequence" :
+            case 'sequence':
+            case 'date':
+            case 'initial-creator':
             {
-                $paragraphContent .= $childNode->textContent();
+                $paragraphContent .= $childNode->textContent;
             }break;
 
-            case "date" :
-            {
-                $paragraphContent .= $childNode->textContent();
-            }break;
-
-            case "initial-creator" :
-            {
-                $paragraphContent .= $childNode->textContent();
-            }break;
-
             case "s" :
             {
                 $paragraphContent .= " ";
@@ -1537,13 +1494,13 @@
 
             case "a" :
             {
-                $href = $childNode->attributeValueNS( 'href', 'http://www.w3.org/1999/xlink' );
-                $paragraphContent .= "<link href='$href'>" . $childNode->textContent() . "</link>";
+                $href = $childNode->getAttributeNS( self::NAMESPACE_XLINK, 'href' );
+                $paragraphContent .= "<link href='$href'>" . $childNode->textContent . "</link>";
             }break;
 
             case "#text" :
             {
-                $tagContent = str_replace( "&", "&amp;", $childNode->content() );
+                $tagContent = str_replace( "&", "&amp;", $childNode->textContent );
                 $tagContent = str_replace( ">", "&gt;", $tagContent );
                 $tagContent = str_replace( "<", "&lt;", $tagContent );
                 $tagContent = str_replace( "'", "&apos;", $tagContent );
@@ -1555,25 +1512,23 @@
             case "span" :
             {
                 // Fetch the style from the span
-                $styleName = $childNode->attributeValueNS( 'style-name', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' );
+                $styleName = $childNode->getAttributeNS( self::NAMESPACE_TEXT, 'style-name' );
 
                 // Check for bold and italic styles
                 $fontWeight = false;
                 $fontStyle = false;
                 foreach ( $this->AutomaticStyles as $style )
                 {
-                    $tmpStyleName = $style->attributeValueNS( "name", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
+                    $tmpStyleName = $style->getAttributeNS( self::NAMESPACE_STYLE, "name" );
 
                     if ( $styleName == $tmpStyleName )
                     {
-                        if ( count( $style->children() >= 1 ) )
+                        if ( $style->childNodes->length >= 1 )
                         {
-                            $children = $style->children();
-
-                            foreach ( $children as $styleChild )
+                            foreach ( $style->childNodes as $styleChild )
                             {
-                                $fontWeight = $styleChild->attributeValue( 'font-weight' );
-                                $fontStyle = $styleChild->attributeValue( 'font-style' );
+                                $fontWeight = $styleChild->getAttribute( 'font-weight' );
+                                $fontStyle = $styleChild->getAttribute( 'font-style' );
                             }
                         }
                     }
@@ -1590,8 +1545,9 @@
                     $paragraphContent .= "<strong>";
                 if ( $fontStyle == "italic" )
                     $paragraphContent .= "<emphasize>";
-                $paragraphContent .= $childNode->textContent();
 
+                $paragraphContent .= $childNode->textContent;
+
                 if ( $fontStyle == "italic" )
                     $paragraphContent .= "</emphasize>";
                 if ( $fontWeight == "bold" )
@@ -1605,7 +1561,7 @@
 
             default:
             {
-                eZDebug::writeError( "Unsupported node: " . $childNode->name() . "<br>" );
+                eZDebug::writeError( "Unsupported node: " . $childNode->localName . "<br>" );
             }break;
 
         }
@@ -1661,7 +1617,6 @@
                 $dataMap[$titleAttribudeIdentifier]->setAttribute( 'data_text', $name );
                 $dataMap[$titleAttribudeIdentifier]->store();
 
-                include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
                 $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
                                                                                              'version' => 1 ) );
 
@@ -1681,22 +1636,12 @@
 
     /*!
       \private
+      \deprecated use $node->textContent directly
       Converts a dom node/tree to a plain ascii string
     */
     function domToText( $node )
     {
-        $textContent = "";
-
-        foreach ( $node->children() as $childNode )
-        {
-            $textContent .= eZOOImport::domToText( $childNode );
-        }
-
-        if  ( $node->name() == "#text" )
-        {
-            $textContent .= $node->content();
-        }
-        return $textContent;
+        return $node->textContent;
     }
 
 
Index: modules/ezodf/import.php
===================================================================
--- modules/ezodf/import.php	(revision 3273)
+++ modules/ezodf/import.php	(working copy)
@@ -27,7 +27,6 @@
 //
 
 include_once( "kernel/common/template.php" );
-include_once( 'lib/ezxml/classes/ezxml.php' );
 include_once( 'lib/ezutils/classes/ezhttpfile.php' );
 
 include_once( 'kernel/classes/ezcontentobject.php' );
