note 69805 rejected from ref.xml by bobby

From: Date: Thu, 21 Sep 2006 20:41:41 +0000
Subject: note 69805 rejected from ref.xml by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117396@lists.php.net to get a copy of this message
Note Submitter: info at ichier dot de ---- the task: xml to multidimensional array ok folks i tested millions... of solutions and none worked for me, none returned the real structure i did my own parser a while ago and i am using it, but it doesnt work in some cases so i was searching for an other one - damn the parser itself was adapted somwhere the heartpiece is the compact part, and there are open ends, was too lazy today to solve it... (and still am) so, im posting an example xml and my functions and hope someone else finds a solution, ill be back on monday ;) <?xml version="1.0"?> <root> <version>1.7</version> <skin caption="Blueline" /> <skin stylesheet="/skins/ichier_blueline/ichier_blueline.css" /> <colors c0="#000066" /> <colors c1="#becfe6" /> <subskin> <skin caption="green" /> <skin stylesheet="/skins/ichier_blueline/ichier_greenline.css" /> </subskin> <subskin> <caption>red</caption> <skin stylesheet="/skins/ichier_blueline/ichier_redline.css" /> </subskin> </root> in that case im doing this: <?php $xml2arr = new ixml_get_array(); $skin = ixml_compact_array($xml2arr->parse($file), true, 'all', true, false, true); ?> that should result in: Array ( [_DATA] => [root] => Array ( [_DATA] => [version] => 1.7 [skin] => Array ( [caption] => Blueline [stylesheet] => /skins/ichier_blueline/ichier_blueline.css ) [colors] => Array ( [c0] => #000066 [c1] => #becfe6 ) [subskin] => Array ( [skin] => Array ( [caption] => green [stylesheet] => /skins/ichier_blueline/ichier_greenline.css [_DATA] => ) ) [subskin] => Array ( [skin] => Array ( [caption] => red [stylesheet] => /skins/ichier_blueline/ichier_redline.css [_DATA] => ) ) ) ) if you leave the subskins it'll put out what it should: an array representing 1:1 what the xml says but when its getting deeper its evil as said: until subskins it works! - so everybody may use it for simple purposes until it got fixed :þ so far - here is my code: (i cleaned it a bit from my special error calls etc. but kept the current control output) ok, because the post was to long the code is at www.ichier.de/files/xml.txt hope it helps somebody ... and maybe someone has an idea whats wrong :P i know its not really a performance-ace, but its closest to what i need niko

« previous php.notes (#117396) next »