Ask a Question related to Macromedia Flash Data Integration, Design and Development.
-
pijus #1
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:
As you see, values are different everytime, how can I access them?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>
Will a loop work in this structure?
THANK'S A LOT FOR YOUR HELP
pijus Guest
-
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... -
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... -
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... -
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... -
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... -
Nancy #2
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:
>> As you see, values are different everytime, how can I access them?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> >
> Will a loop work in this structure?
> THANK'S A LOT FOR YOUR HELP
>
Nancy Guest
-
miquael #3
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
-
miquael #4
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
-
miquael #5
Re: Problem with complex XML
So in this case, the children are equal, but the loop still does not work ...
miquael Guest



Reply With Quote

