Loading ...
Sorry, an error occurred while loading the content.

3373Re: nexted XML output under single node from while loop

Expand Messages
  • jpeyser
    Feb 19, 2004
    • 0 Attachment
      Try

      for (1..2) {
      push(@args,(
      SOAP::Data->name("RadiusAttribute"=> \SOAP::Data->value(
      SOAP::Data->name("type"=>$name),
      SOAP::Data->name("value"=>$value)
      ))));
      }

      $args = SOAP::Data->name("attributes"=> \SOAP::Data->value(@args));

      Jonathan

      --- In soaplite@yahoogroups.com, "ask4uk" <jon@a...> wrote:
      > Hello,
      >
      > I am trying to produce XML output of the form:
      >
      > <attributes>
      > <RadiusAttribute>
      > <type>string</type>
      > <value>string</value>
      > </RadiusAttribute>
      > <RadiusAttribute>
      > <type>string</type>
      > <value>string</value>
      > </RadiusAttribute>
      > </attributes>
      >
      > I am using the code snippet below, based on the various samples in
      > this list:
      >
      > while (($name, $value) = $p->get_attr_val_n($i++))
      > {
      > #push(@args, SOAP::Data->name('attribute' => [$name,
      > $value]));
      >
      >
      > push(@args,( SOAP::Data->name("attributes"=>
      > \SOAP::Data->name
      > ("RadiusAtrtibute"=>
      > \SOAP::Data->value(SOAP::Data->name
      > ("type"=>$name)),
      > \SOAP::Data->value(SOAP::Data->name
      > ("value"=>$value))
      > )
      > )));
      > }
      >
      > However, this creates a separate "attributes" node for each
      iteration
      > of the loop (fairly obviously, when you think about it...) and I
      only
      > want one attributes node with multiple children. I have scoured the
      > net without much luck on this one and am now banging my head on the
      > desk. Any thoughts gratefully received!
      >
      > Regards
      >
      > Jonathan
    • Show all 2 messages in this topic