A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: help with this xml message structure

  1. #1
    Senior Member
    Join Date
    Nov 2000
    Posts
    136
    I am sending the server an xml message containing the information to add a new user to the application. The items that will be transferred are:

    firstname, lastname, username, password, email, and groups

    Where "groups" may be one or many, depending on how many groups the user will be a member of.

    I cannot decide the "best" way to code the xml so that the server side parsing routine can logically extract the data. Here is my approach (please suggest alternatives)

    <request action="add_user">
    <request_item label="firstname" value="john" />
    <request_item label="lastname" value="john" />
    <request_item label="username" value="bigjohn" />
    <request_item label="password" value="bigbadjohn" />
    <request_item label="email" value="john@hotmail.com" />
    <request_item label="groups">
    <group value="1" />
    <group value="2" />
    <group value="3" />
    </request_item>
    </request>

  2. #2
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    usually I go for a container XML tag when I have a collection of items eg:

    < user>
    < name>Bill< /name>
    < email>billyg@microsoft.com< /email>
    < groups>
    < group name="World Domination Newbies" \>
    < group name="Advanced Business Tactics" \>
    < group name="Bucket Loads of Money -- How to spend" \>
    < /groups>
    < /user>

    This way you can parse through your groups collection and know that all the child nodes (which are whitespace :-) are going to be group information.

    It also maps to an object oriented way of doing things where each group item will be stored as an array or collection.

    Thanks

    Luke

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center