php - How to generate an XML with comments with CakePHP? -



php - How to generate an XML with comments with CakePHP? -

cakephp provides functionality generate xml documents/strings array (s. cakephp docu -> core libraries -> utilities -> xml -> transforming array string of xml).

simple example:

$xmlarray = array( 'project' => array( '@id' => 1, 'name' => 'name of project, tag', '@' => 'value of project' ) ); $xmlobject = xml::fromarray($xmlarray); $xmlstring = $xmlobject->asxml();

result:

<?xml version="1.0"?> <project id="1">value of project<name>name of project, tag</name></project>

now i'd generate xml 1 or more comments, this:

<?xml version="1.0"?> <!-- here comment --> <project id="1">value of project<name>name of project, tag</name></project>

is possible? how that?

comment:

this question marked duplicate of "is possible insert comment tag xml using simplexml?". not duplicate question, since it's more specific , refers xml comments in context of cakephp xml generation -- , not "plain" php or simplexml.

no, you're creating simplexmlelement can insert comment own.

see existing q&a of topic:

is possible insert comment tag xml using simplexml?

php xml cakephp comments xml-comments

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -