Menu

Readout Attributes

Help
2004-07-12
2004-07-12
  • Thomas Buerkli

    Thomas Buerkli - 2004-07-12

    Hi

    How can i readout attributes from a parameter?

    I dont understand the stuff with the SOAPHashMap.
    Could anyone give me a example?

    Thanks,
    Thomas

     
    • David Crowley

      David Crowley - 2004-07-12

      To get the value of a known attribute, do something like this:

      SOAPParameter *p; // Given a pointer to a parameter
      SOAPParameter::Attrs::Iterator href = p->GetAttributes().Find("href");
      if (href)
      {
         const char *value = href.Item().GetName();
         ...
      }

      To iterate over all attributes on a parameter you would do something like this:

      for (SOAPParameter::Attrs::Iterator i = p->GetAttributes().Begin(); i; ++i)
      {
         const char *name = i.Key().GetName();
         const char *value = i.Item().GetName();
         ...
      }

      The Key and Item values in the Hashmap are of type SOAPQName.  The GetName() method returns the name portion of the QName and is most likely the value you are interested in.

       

Log in to post a comment.