Problem with complex XML

Ask a Question related to Macromedia Flash Data Integration, Design and Development.

  1. #1

    Default Problem with complex XML

    Hi!
    I have a problem that for some will be trivial, but for me it is getting on my
    nervs.
    All the tutorials and tips I have seen around about AS2 and XML are based on
    very simple XML sintax done in purpose for flash, but when the XMl is a little
    complicated things doesn't work for me...
    I have an XML that looks something like:
    Code:
    <content>
    <values name="">
    <numbers type="" name="" mode="" / >
    <shapes  color="" size="" style=""/ >
    </values>
    <values name="">
    <members city="" pets="" model="" / >
    <questions  first="" second="" third="" / >
    <problems difficulty="" / >
    </values>
    </content>
    As you see, values are different everytime, how can I access them?
    Will a loop work in this structure?
    THANK'S A LOT FOR YOUR HELP

    pijus Guest

  2. Similar Questions and Discussions

    1. Problem with FMS2 calling web service with complex typeas input
      I wrote a web service in weblogic 9.2: @WebMethod public LoginResponse Login2(LoginRequest loginRequest) { LoginResponse loginResponse = new...
    2. Complex SQL?
      Hi, I have a table which contains subscriptions from students, bu they are tagged with a date (so I have a kind of history). Both 'email' and...
    3. Problem when heavy reporting and complex queries
      Hi.. im doing a reporting system that involves heavy data retrieval from database. Data source is Informix, connected via JDBC. Im talking about 20...
    4. Flash Newbie Complex Problem
      Hello Have a project that I am told is best done with Flash but do not know where to start. I want to put a country map with state boundaries on...
    5. BIG problem when sending complex datatype to a webservice
      OK. I'll try explain my problem so simple as possible. I have to send a complex data type to a WebService from a Asp.net webapplication. My...
  3. #2

    Default Re: Problem with complex XML

    And this validates? It doesn't look like well formed XML to me .. it has to
    be valid XML or you're asking for trouble from the getgo.


    --
    Nancy Gill
    Adobe Community Expert
    Author: Dreamweaver 8 e-book for the DMX Zone
    Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
    Technical Editor: Dreamweaver CS3: The Missing Manual,
    DMX 2004: The Complete Reference, DMX 2004: A Beginner's Guide
    Mastering Macromedia Contribute
    Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development

    "pijus" <webforumsuser@macromedia.com> wrote in message
    news:fqpn81$i33$1@forums.macromedia.com...
    > Hi!
    > I have a problem that for some will be trivial, but for me it is getting
    > on my
    > nervs.
    > All the tutorials and tips I have seen around about AS2 and XML are based
    > on
    > very simple XML sintax done in purpose for flash, but when the XMl is a
    > little
    > complicated things doesn't work for me...
    > I have an XML that looks something like:
    >
    Code:
    > <content>
    > <values name="">
    > <numbers type="" name="" mode="" / >
    > <shapes  color="" size="" style=""/ >
    > </values>
    > <values name="">
    > <members city="" pets="" model="" / >
    > <questions  first="" second="" third="" / >
    > <problems difficulty="" / >
    > </values>
    > </content>
    >
    > As you see, values are different everytime, how can I access them?
    > Will a loop work in this structure?
    > THANK'S A LOT FOR YOUR HELP
    >

    Nancy Guest

  4. #3

    Default Re: Problem with complex XML

    Look like fine XML to me ...

    I am also having problems with XML parsing. And I have had success with very
    simple XML, for example, with this XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <items>
    <item id="0" title="0, 0" type="1" contentPath="sample.html">
    <description>Description here.</description>
    <georss>0 0</georss>
    </item>
    <item id="1" title="New York City" type="2" contentPath="sample.flv">
    <description>Description here.</description>
    <georss>42.3583 -75.85</georss>
    </item>
    <item id="2" title="Rome" type="3" contentPath="sample.html">
    <description>Description here.</description>
    <georss>41.54 -12.27</georss>
    </item>
    </items>

    I can use this, and it will parse the above XML (which is then handled as
    independent objects per <item> in the Node class):








    public function processMarkerData (xmlData:XML):void {
    // loop through all markers in the XML
    // and generate a node for each one
    trace ("xmlData: " + xmlData);
    for each (var xmlPlacemark:XML in xmlData.item) {

    trace ("success!");

    // create node
    var node:Node = new Node(
    xmlPlacemark,
    {
    nodeID: nodeID,
    app: this
    });

    }
    }

    miquael Guest

  5. #4

    Default Re: Problem with complex XML

    But when I change the structure a little, this won't work! Why not? I just
    want to create one Node for each <placemark> tag in the xml.

    The XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://earth.google.com/kml/2.2">
    <Placemark id="0" type ="1">
    <name>Zero - zero</name>
    <description>This is at zero latitude and zero longitude</description>
    <Point>
    <coordinates>0,0,0</coordinates>
    </Point>
    </Placemark>

    <Placemark id="1" type ="2">
    <name>Simple placemark</name>
    <description>Attached to the ground. Intelligently places itself
    at the height of the underlying terrain.</description>
    <Point>
    <coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
    </Point>
    </Placemark>

    <Placemark id="2" type ="3">
    <name>New York City</name>
    <description>This is a rockin' town</description>
    <Point>
    <coordinates>42.3583,-75.85,0</coordinates>
    </Point>
    </Placemark>
    </kml>


    Yet, I cannot even get the second "success!" trace. It's almost exactly the
    same as above! (xmlData.item vs. xmlData.Placemark)






    Attach Code

    public function processMarkerData (xmlData:XML):void {

    // loop through all markers in the XML
    // and generate a node for each one
    trace ("xmlData: " + xmlData);

    for each (var xmlPlacemark:XML in xmlData.Placemark) {

    trace ("success!");

    // create node
    var node:Node = new Node(
    xmlPlacemark,
    {
    nodeID: nodeID,
    app: this
    });

    }
    }
    }

    miquael Guest

  6. #5

    Default Re: Problem with complex XML

    So in this case, the children are equal, but the loop still does not work ...
    miquael Guest

Posting Permissions

  • You may not post new threads
  • You may 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