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

Result question

Expand Messages
  • Ryan
    All, I m just starting out with SOAP::Lite, and have a quick question. The service that I m working with returns something like the following section:
    Message 1 of 2 , Nov 30, 2004
    View Source
    • 0 Attachment
      All,

      I'm just starting out with SOAP::Lite, and have a quick question. The
      service that I'm working with returns something like the following
      section:

      <..cut..>
      <lines>
      <line uuid="{1805FB04-AA05-427C-9B5B-60A09B2FCA95}" index="2">
      <display>display</display>
      <dirn uuid="{4987C658-3383-4302-A949-9C431E80E38B}"></dirn>
      <...cut...>
      </line>
      </lines>
      <..cut..>

      I've been using xpaths to get the value from the other elements such
      as the <display> element, but this one is a bit different. How do I
      get the uuid value from the <dirn> element. Is this even possible
      with SOAP::Lite? If so, how?

      Thanks in advance!
      Ryan
    • Duncan Cameron
      ... I take it that bt xpath you mean the S::L method of specifying an xpath using match(), dataof() etc. To get the value of an attribute you need to use the
      Message 2 of 2 , Nov 30, 2004
      View Source
      • 0 Attachment
        At 2004-12-01, 06:44:23 Ryan <pseudo_echo@...> wrote:

        >All,
        >
        >I'm just starting out with SOAP::Lite, and have a quick question. The
        >service that I'm working with returns something like the following
        >section:
        >
        ><..cut..>
        ><lines>
        > <line uuid="{1805FB04-AA05-427C-9B5B-60A09B2FCA95}" index="2">
        > <display>display</display>
        > <dirn uuid="{4987C658-3383-4302-A949-9C431E80E38B}"></dirn>
        > <...cut...>
        > </line>
        ></lines>
        ><..cut..>
        >
        >I've been using xpaths to get the value from the other elements such
        >as the <display> element, but this one is a bit different. How do I
        >get the uuid value from the <dirn> element. Is this even possible
        >with SOAP::Lite? If so, how?
        >
        I take it that bt xpath you mean the S::L method of specifying an xpath
        using match(), dataof() etc.
        To get the value of an attribute you need to use the dataof() method
        nstead of valueof(). The result will be a SOAP::Data object from which
        you can get an attribute through the attr() method (I think).

        my $d = $som->dataof(...); # returns a SOAP::Data item

        my $attr = $d->attr->{'uuid'};

        Duncan
      Your message has been successfully submitted and would be delivered to recipients shortly.