Forums / Developer / HOWTO? from plain text to xmltext datatype ...

HOWTO? from plain text to xmltext datatype ...

Author Message

Björn [email protected]

Friday 30 July 2004 3:40:38 am

        include_once( "kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinput.php" );
        $simplifiedXMLInput = new eZSimplifiedXMLInput( $dumpdata, null, null );
		$address = "<line>bjoern dieding</line><line>asdasdasd</line><line>Germany</line>";
		
		$bodyData = "<section xmlns:image='http://ez.no/namespaces/ezpublish3/image/' xmlns:xhtml='http://ez.no/namespaces/ezpublish3/xhtml/' xmlns:custom='http://ez.no/namespaces/ezpublish3/custom/' >";
        $bodyData .= "<paragraph>";
        $bodyData .= $address;
        $bodyData .= "</paragraph>";
        $bodyData .= "</section>";
        $Data = $simplifiedXMLInput->convertInput( $bodyData );
        $xml = $Data[0]->toString();
        var_dump($xml);
        $data_map['address']->setAttribute( 'data_text', $xml );
        $data_map['address']->store();

What is the best way to turn any type text into the content of a xml text field?

I don't wanna have all the tags in my code! Any ideas?

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Bård Farstad

Wednesday 18 August 2004 12:09:14 am

The way you do it in the example above is ok. If you don't want to have the tags in your code you should look into using the XML dom structure.

--bård

Documentation: http://ez.no/doc