| Friday 14 September 2007 1:30:13 am 
                                                                 You can try to build a module implementing this a function like this : 
    function build_xml_string($string_to_convert) {    
	 include_once( "lib/ezxml/classes/ezxml.php" );
        $doc = new eZDOMDocument( "" );
        // create the root xml node
        $root = $doc->createElementNode( "section" );			
        $doc->setRoot( $root );
        $root->appendAttribute( $doc->createAttributeNode( "xmlns:image", "http://ez.no/namespaces/ezpublish3/image/" ) );
        $root->appendAttribute( $doc->createAttributeNode( "xmlns:xhtml", "http://ez.no/namespaces/ezpublish3/xhtml/" ) );
        
        $content_paragraphs = explode ("\r\n\r\n", $string_to_convert);
        foreach ($content_paragraphs as $content_paragraph) {
	        unset( $paragraph_node );
			$paragraph_node =& $doc->createElementNode( "paragraph" );
			$content_lines = explode ("\r\n", $content_paragraph);
  			foreach ($content_lines as $content_line) {
				unset( $line_node );
				unset( $text_node );
				$line_node =& $doc->createElementNode( "line" );
				$paragraph_node->appendChild( $line_node );						
				$text_node =& $doc->createTextNode( $content_line );
				$line_node->appendChild($text_node);
			}	
			$root->appendChild( $paragraph_node );
        }
        
		$xml_string = $doc->toString();
        return $xml_string;
    }
After what you just have to retrieve the content of your linetext attributes, convert it using this function, and assign it to the data_text field of your XMLBloc attributes like this 
    $xmlbloc_contentobjectattribute->setAttribute("data_text", $xml_string);
But it's a "dirty" way to do if you think about forward compatibilty, because the XML model of XMLBloc attributes can be changed in the future.A better way to do it would be to refer to /kernel/classes/datatypes/ezxmltext/ezxmlschema.php or something like this.
 |