note 76409 added to function.xml-parse-into-struct
| From: | php dot net at crazedsanity dot com | Date: | Fri, 13 Jul 2007 17:43:14 +0000 |
| Subject: | note 76409 added to function.xml-parse-into-struct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128445@lists.php.net to get a copy of this message | ||
If you're interested in something that creates arrays in PHP, handles attributes well, and is
easily transferrable back into XML, you may want to take a look at the cs-phpxml project at
SourceForge.net (http://sf.net/projects/cs-phpxml). It's not necessarily documented very well,
but it will do something like this:
<?php
/**
*
* *********** EXAMPLE ***********
*
* Original file contents:
* <test xmlns="stuff">
* <indexOne>hello</indexOne>
* <my_single_index testAttribute="hello" />
* <multiple_items>
* <item>1</item>
* <item>2</item>
* </multiple_items>
* </test>
*
* Would return:
*
* array(
* TEST => array(
* type => 'open',
* attributes => array(
* xmlns => 'stuff'
* )
* INDEXONE => 'hello',
* MY_SINGLE_INDEX = array(
* type => 'complete',
*
* )
* )
* );
*/
?>
It's presently under development, but I'm using it in several production environments.
The XMLCreator is kinda clunky (builds XML within PHP code). NOTE: it has a dependency on
"cs-arraytopath", also available at sourceforge via http://sf.net/projects/cs-arraytopath . The setup
is a bit irritating, and it's fragile when handling quoting & formatting the data, but I
think it's worth the hassle for most projects.
----
Server IP: 64.71.164.2
Probable Submitter: 216.239.10.113
----
Manual Page -- http://www.php.net/manual/en/function.xml-parse-into-struct.php
Edit -- https://master.php.net/note/edit/76409
Del: integrated -- https://master.php.net/note/delete/76409/integrated
Del: useless -- https://master.php.net/note/delete/76409/useless
Del: bad code -- https://master.php.net/note/delete/76409/bad+code
Del: spam -- https://master.php.net/note/delete/76409/spam
Del: non-english -- https://master.php.net/note/delete/76409/non-english
Del: in docs -- https://master.php.net/note/delete/76409/in+docs
Del: other reasons-- https://master.php.net/note/delete/76409
Reject -- https://master.php.net/note/reject/76409
Search -- https://master.php.net/manage/user-notes.php