Professional Web Applications Themes

How do i Parsing xml - Macromedia Flash Data Integration

This how my customers xml is coming across and can not change. <month name="January"> <day> <date>01</date> <name>Thursday</name> <time>12:03 PM</time> <comment>It is a hot day</comment> </day> <day> <date>05</date> <name>Monday</name> <time>09:28 AM</time> <comment>Another hot day</comment> </day> </month> The above data structure uses a new node for each bit of core information. It is well laid out and very readable by humans, however a better structure exists when using Flash. The data structure below makes more use of the attributes feature, speeding the parsing process up. It takes longer for Flash to read 6 separate nodes, than it does 6 attributes of a ...

  1. #1

    Default How do i Parsing xml

    This how my customers xml is coming across and can not change.
    <month name="January">
    <day>
    <date>01</date>
    <name>Thursday</name>
    <time>12:03 PM</time>
    <comment>It is a hot day</comment>
    </day>
    <day>
    <date>05</date>
    <name>Monday</name>
    <time>09:28 AM</time>
    <comment>Another hot day</comment>
    </day>
    </month>

    The above data structure uses a new node for each bit of core information. It
    is well laid out and very readable by humans, however a better structure exists
    when using Flash. The data structure below makes more use of the attributes
    feature, speeding the parsing process up. It takes longer for Flash to read 6
    separate nodes, than it does 6 attributes of a node. The data structure below
    is suited better for use with Flash.

    How do I get it formated like this?
    <month name="January">
    <day date="01" name="Thursday" time="12:03 PM" comment="It is a hot day" />
    <day date="05" name="Monday" time="09:28 AM" comment="Another hot day" />
    </month>

    Todd Dignan Guest

  2. #2

    Default Re: How do i Parsing xml

    Hello there,

    Depending on which version of Flash you're using the parsing of XML is a
    little different in Actionscript 3 then Actionscript 2. I personally like the
    AS3 way as it's easier to traverse the XML tree.

    Here is how I would p your new structure above in both versions

    Noelbaland Guest

  3. #3

    Default Re: How do i Parsing xml

    Thanks for the response. I have Flash 8 (AS2)

    When I user your sample this is what it get.

    January

    DATE: undefined
    NAME: undefined
    TIME: undefined
    COMMENT: undefined

    DATE: undefined
    NAME: undefined
    TIME: undefined
    COMMENT: undefined


    Everything looks good up to the loop.
    When I trace the loop I get undefined. I could not figure out why.

    Thanks for your help ahead of time.

    Todd Dignan Guest

  4. #4

    Default Re: How do i Parsing xml

    Hello again,

    Sorry, I thought you wanted to know how to p XML for this structure

    <month name="January">
    <day date="01" name="Thursday" time="12:03 PM" comment="It is a hot day" />
    <day date="05" name="Monday" time="09:28 AM" comment="Another hot day" />
    </month>

    This is the one that the code I wrote is using. I think you're loading in the
    other one. Doesn't matter - I've included the for loop for both structures
    below so that you can try it with both.

    Noelbaland Guest

Similar Threads

  1. parsing XML
    By miquael in forum Macromedia Flash Data Integration
    Replies: 21
    Last Post: March 21st, 10:11 PM
  2. PDF Parsing
    By Tamir_Noach@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 1
    Last Post: December 31st, 07:04 PM
  3. Parsing URL
    By Mercedissa1@netscape.net in forum PERL Beginners
    Replies: 2
    Last Post: September 9th, 08:34 PM
  4. Parsing PHP
    By Nikhil G. Daddikar in forum PHP Development
    Replies: 1
    Last Post: July 27th, 05:46 PM
  5. [PHP] Parsing PHP
    By Peter James in forum PHP Development
    Replies: 0
    Last Post: July 26th, 07:11 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139