[development] trouble destructing xml

Matt matt at aleph-null.tv
Fri Mar 25 01:39:06 UTC 2011


In QueryPath it would be:

<?php
$xml = '<this>
<that parm1="a" parm2="b" parm3="c">red</that>
<that parm1="e" parm2="f" parm3="d">blue</that>
</this>';

// Loop through all <that> elements...
foreach (qp($xml, 'that') as $that) {

  // Get the text for each <that> element.
  print $that->text();

}
?>

On Thu, Mar 24, 2011 at 8:09 PM, <jeff at ayendesigns.com> wrote:

> When all else fails, and #xml, ##php and #drupal-support come up
> empty...ask the folks who actually code :)
>
> I have an xml structure that has
>
> <this>
> <that parm1="a" parm2="b" parm3="c">red</that>
> <that parm1="e" parm2="f" parm3="d">blue</that>
> </this>
>
> 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.
>
> I'm curious what else people are using.
>
> Jeff
> --
> *I am a non sequitur. Beware, the contents were packaged where peanuts are
> processed.*
>
> Ayen Designs
> 388 Bullsboro Drive #105 · Newnan, Georgia 30263
> 404-271-9734
> Web:ayendesigns.com
> Blog: theAccidentalCoder.com <http://theaccidentalcoder.com/>
> Drupal: j. ayen green <http://drupal.org/user/367108> (367108)
> IRQ: j_ayen_green
> IM (Yahoo) baalwww    (MSN) baalwww at yahoo.com
> Skype: ayendesigns | Facebook: ayendesigns | Twitter: @ayendesigns
>
>
>
> Ayen Designs is the computer services division of
>



-- 
http://technosophos.com
http://querypath.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110324/615589b2/attachment.html 


More information about the development mailing list