Forums / Developer / import ezxml datatype in PHP CLI script / Comment46332
Kirill Subbotin
Wednesday 12 July 2006 3:46:01 am
I verified that fix, and found that it's not ok too. See my reporthttp://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(); }