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

Struct Inside an Array

Expand Messages
  • Mike Romero
    Here s one feature of LiveJournal that I am trying to work on. One of the things that makes LJ popular is its associated post metadata, like what mood one is
    Message 1 of 1 , Apr 30 11:25 PM
    View Source
    • 0 Attachment
      Here's one feature of LiveJournal that I am trying to work on. One of
      the things that makes LJ popular is its associated post metadata, like
      what mood one is in, or what song one is listening to, what location
      they're in, etc. Here is the spec for this:

      props(optional): Set arbitrary (but restricted) meta-data properties
      to this log item. See Chapter 12: Journal Item Meta-data for the
      documentation of the keys and value data types.

      [array](required)The following 'struct' should have property names as
      the keys, and the values should be a scalar data type. Containing items:
      [struct](optional; multiple allowed)
      Containing keys: (whatever keys you want to send)

      I assume that the XML would look like:
      <array>
      <data>
      <struct>
      <member>
      <name>somename</name>
      <value>somevalue</value>
      </member>
      <member>
      <name>somename2</name>
      <value>somevalue2</value>
      </member>
      </struct>
      </data>
      </array>

      My question is, what is the best way to code this? I was going to use
      an XmlRpcStruct for the struct here (since you have an arbitrary
      number of things here depending on what the end user enters), and an
      object[] array with a length of 1. Is this correct? If it is, does it
      matter what I name the XmlRpcStruct, or only the array (i.e., name the
      array props since that's the member name going to the server and just
      name the struct foo because it's inside of it?) If I'm incorrect, what
      would be the correct syntax here?
    Your message has been successfully submitted and would be delivered to recipients shortly.