Share » Forums » Developer » import ezxml datatype in PHP CLI script

import ezxml datatype in PHP CLI script

import ezxml datatype in PHP CLI script

Tuesday 11 July 2006 1:58:47 am - 5 replies

Modified on Tuesday 11 July 2006 1:59:23 am by Fabio Carissimi

Author Message

Kirill Subbotin

Wednesday 12 July 2006 12:29:52 am

Which eZp version are you using?

Fabio Carissimi

Wednesday 12 July 2006 2:13:22 am

Hello,

This is eZpublish 3.8.0 with php 4.4.2, MySql 4.1.18, Apache 2.0.55 (on a Mandriva Linux Limited Edition 2005).

Thanks for help

Fabio Carissimi

Wednesday 12 July 2006 2:48:34 am

Your question helps me to find the problem,
I have upgraded to eZpublish 3.8.1 and it works fine

it was a bug and it has been fixed: see http://ez.no/bugs/view/8343

Thanks for your help :-)

Kirill Subbotin

Wednesday 12 July 2006 3:46:01 am

I verified that fix, and found that it's not ok too. See my report
http://ez.no/community/bugs/rss_import_to_xml_text_block_is_broken

Here is the correct function for 3.8 :

function setEZXMLAttribute( &$attribute, &$attributeValue, $link = false )
{
    include_once( 'kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php' );
    $contentObjectID = $attribute->attribute( "contentobject_id" );
    $parser = new eZSimplifiedXMLInputParser( $contentObjectID, false, 0 );

    $attributeValue = str_replace( "\r", '', $attributeValue );
    $attributeValue = str_replace( "\n", '', $attributeValue );
    $attributeValue = str_replace( "\t", ' ', $attributeValue );

    $document = $parser->process( $attributeValue );
    if ( !is_object( $document ) )
    {
        $cli =& eZCLI::instance();
        $cli->output( 'Error in xml parsing' );
        return;
    }
    $domString = eZXMLTextType::domString( $document );

    $attribute->setAttribute( 'data_text', $domString );
    $attribute->store();
}

Fabio Carissimi

Wednesday 12 July 2006 9:06:24 am

ok
I am using this one now and everything is ok

Thanks

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu