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

How to access attributes (not in header)

Expand Messages
  • slowloris272000
    Hi It must be a silly question. How can I match a element with attributes? Say, SOAP server responded to my query, and these records are in the response.
    Message 1 of 2 , Nov 11, 2002
      Hi

      It must be a silly question. How can I match a element with
      attributes?

      Say, SOAP server responded to my query, and these records
      are in the response.

      <singer no="1">
      <name>John Smith</name>
      <title>CD 1</title>
      <title>CD 2</title>
      </singer>
      <singer no="2">
      <name>Kelly Lee</name>
      <title>Tune 1</title>
      <title>Tune 2</title>
      </singer>

      How do I retrieve data (SOM subset) for singer no=2?
      $som->valueof('//singaer@no=2')

      if I use paramsout and loop to do serial search,
      it works but obviously it's slow and bad idea.

      How do I directly lookup a element which has a specific
      attribute?

      thanks.
      ken
    • Martin McFly
      If your client looked like this: $result = $soap- yourFunctionCall(...); And assuming that is in Array context, you can retrieve specific tags by
      Message 2 of 2 , Nov 13, 2002
        If your client looked like this:

        $result = $soap->yourFunctionCall(...);

        And assuming that <singer> is in Array context, you can retrieve
        specific tags by using:

        $result->[0]->{name}

        or

        $result->[1]->{title}


        --- In soaplite@y..., "slowloris272000" <noguken@h...> wrote:
        > Hi
        >
        > It must be a silly question. How can I match a element with
        > attributes?
        >
        > Say, SOAP server responded to my query, and these records
        > are in the response.
        >
        > <singer no="1">
        > <name>John Smith</name>
        > <title>CD 1</title>
        > <title>CD 2</title>
        > </singer>
        > <singer no="2">
        > <name>Kelly Lee</name>
        > <title>Tune 1</title>
        > <title>Tune 2</title>
        > </singer>
        >
        > How do I retrieve data (SOM subset) for singer no=2?
        > $som->valueof('//singaer@no=2')
        >
        > if I use paramsout and loop to do serial search,
        > it works but obviously it's slow and bad idea.
        >
        > How do I directly lookup a element which has a specific
        > attribute?
        >
        > thanks.
        > ken
      Your message has been successfully submitted and would be delivered to recipients shortly.