adduc/cdata-simplexml

Wrapper around SimpleXMLElement to provide cdata support.

1.0.0 2018-08-05 08:51 UTC

This package is not auto-updated.

Last update: 2024-11-08 13:29:40 UTC


README

This library adds a wrapper around the SimpleXMLElement class to allow creating CDATA elements.

Usage

<?php

use Adduc\SimpleXMLElement;

$data = '<test/>';
$xml = new SimpleXMLElement($data);
$xml->addCData('element', 'Test Data');
echo $xml->asXml();
// <test><element><![CDATA[Test Data]]></element></test>