<div>For this (and that!) xpath is your friend.</div><div><br></div><div>See this example at <a href="http://php.net/manual/en/simplexmlelement.xpath.php">http://php.net/manual/en/simplexmlelement.xpath.php</a></div><div><br>
</div><div>$string = <<<XML</div><div><a></div><div> <b></div><div> <c>text</c></div><div> <c>stuff</c></div><div> </b></div><div> <d></div><div> <c>code</c></div>
<div> </d></div><div></a></div><div>XML;</div><div><br></div><div>$xml = new SimpleXMLElement($string);</div><div><br></div><div>/* Search for <a><b><c> */</div><div>$result = $xml->xpath('/a/b/c');</div>
<div><br></div><div>while(list( , $node) = each($result)) {</div><div> echo '/a/b/c: ',$node,"\n";</div><div>}</div><div><br></div><div>/* Relative paths also work... */</div><div>$result = $xml->xpath('b/c');</div>
<div><br></div><div>while(list( , $node) = each($result)) {</div><div> echo 'b/c: ',$node,"\n";</div><div>}</div><div><br></div><div><br></div><div>Victor Kane</div><div><a href="http://awebfactory.com.ar">http://awebfactory.com.ar</a></div>
<div><a href="http://projectflowandtracker.com">http://projectflowandtracker.com</a></div><div><br></div><div>On Thu, Mar 24, 2011 at 10:09 PM, <<a href="mailto:jeff@ayendesigns.com">jeff@ayendesigns.com</a>> wrote:</div>
<div>When all else fails, and #xml, ##php and #drupal-support come up empty...ask the folks who actually code :)</div><div><br></div><div>I have an xml structure that has</div><div><br></div><div><this></div><div><that parm1="a" parm2="b" parm3="c">red</that></div>
<div><that parm1="e" parm2="f" parm3="d">blue</that></div><div></this></div><div><br></div><div>I've tried simplexml and a few third-party scripts, one that loads the xml into an associative array rather than an object, and nothing lets me get at 'red' or 'blue'. When I use dsm() on the results, for example, in the case of the object with simplexml I get only one 'that' and do not get its contents. When I use the script that creates the array, I get both that's, and all their parms as elements, but not the colors.</div>
<div><br></div><div>I'm curious what else people are using.</div><div><br></div><div>Jeff</div><div>-- </div><div>I am a non sequitur. Beware, the contents were packaged where peanuts are processed.</div><div>Ayen Designs </div>
<div>388 Bullsboro Drive #105 · Newnan, Georgia 30263 </div><div>404-271-9734</div><div>Web:<a href="http://ayendesigns.com">ayendesigns.com</a></div><div>Blog: theAccidentalCoder.com</div><div>Drupal: j. ayen green (367108)</div>
<div>IRQ: j_ayen_green</div><div>IM (Yahoo) baalwww (MSN) <a href="mailto:baalwww@yahoo.com">baalwww@yahoo.com</a></div><div>Skype: ayendesigns | Facebook: ayendesigns | Twitter: @ayendesigns</div><div><br></div><div>
<br>
</div><div>Ayen Designs is the computer services division of </div><div><br></div><br><div class="gmail_quote">On Thu, Mar 24, 2011 at 10:09 PM, <span dir="ltr"><<a href="mailto:jeff@ayendesigns.com">jeff@ayendesigns.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff" text="#000000">
When all else fails, and #xml, ##php and #drupal-support come up
empty...ask the folks who actually code :)<br>
<br>
I have an xml structure that has<br>
<br>
<this><br>
<that parm1="a" parm2="b" parm3="c">red</that><br>
<that parm1="e" parm2="f" parm3="d">blue</that><br>
</this><br>
<br>
I've tried simplexml and a few third-party scripts, one that loads
the xml into an associative array rather than an object, and nothing
lets me get at 'red' or 'blue'. When I use dsm() on the results,
for example, in the case of the object with simplexml I get only one
'that' and do not get its contents. When I use the script that
creates the array, I get both that's, and all their parms as
elements, but not the colors.<br>
<br>
I'm curious what else people are using.<br>
<br>
Jeff<br>
<div>-- <br>
<em>I am a non sequitur. Beware, the contents were packaged where
peanuts are processed.</em>
<p style="margin-bottom:0in"><img src="cid:part1.09020500.00080802@ayendesigns.com" name="ayenlogo" align="LEFT" border="0" height="54" vspace="30" width="36"><font style="font-size:8pt" size="1">Ayen
Designs
</font><font face="Times New Roman, serif"><font style="font-size:8pt" size="1"><br>
388
Bullsboro Drive #105 · Newnan, Georgia 30263</font></font>
<br>
<font face="Times New Roman, serif"><font style="font-size:8pt" size="1">404-271-9734<br>
Web:<a href="http://ayendesigns.com/" target="_blank">ayendesigns.com</a><br>
Blog:
<a href="http://theaccidentalcoder.com/" target="_blank">theAccidentalCoder.com</a><br>
Drupal:
<a href="http://drupal.org/user/367108" target="_blank">j. ayen green</a>
(367108)<br>
IRQ: j_ayen_green<br>
IM (Yahoo) baalwww (MSN)
<a href="mailto:baalwww@yahoo.com" target="_blank">baalwww@yahoo.com</a><br>
Skype: ayendesigns | Facebook: ayendesigns |
Twitter: @ayendesigns</font></font></p>
<p style="margin-bottom:0in"> <font face="Times New Roman,
serif"><font style="font-size:8pt" size="1"><br>
<br>
Ayen
Designs is the computer services division of <img src="cid:part2.08060706.08000808@ayendesigns.com" name="acmelogo" align="ABSMIDDLE" border="0" height="31" width="80"></font></font></p>
</div>
</div>
</blockquote></div><br>