View Full Version : 'all-purpose' XML parse script.. ?
Stimpson
05-06-2004, 05:20 AM
Hey people, long time no visit :).
I'm parsing some xml (yet again) for a project, and I was wondering if there wasn't somesort of 'all-purpose' XML parsing script around which could parse any given xml, into an object with basicly the same tree structure as the xml doc... handling the xml doc as a black box so to speak.
Right now I'm always parsing based on specific nodes, which can get a bit tedious adapting the script for different projects. I've been fiddling around with this, but not much luck so far.. Could'nt find anything either, all about node specific parsing.
Any of you people got an idea on this?
hmmm.. try using xmlconnector component and databinding. :) works really well.
jon
Stimpson
05-06-2004, 06:01 AM
Yeah, thx :). But I haven't got any other MM components in there right now, so I don't think databinding would help here (I could be wrong though ;)). Unless you could use the xmlconnector alone to get this result perhaps..? And doesn't that need xml schemas or something to work?
Hmm..I guess in those components there would be some script which does exactly what I want here, so it must be possible :D.
splict
05-06-2004, 07:43 AM
could buggedcom's post here (http://www.actionscript.org/forums/showthread.php3?s=&threadid=38433) help, or there are other similar threads. Or are you looking for something different?
-splict
Stimpson
05-06-2004, 09:23 AM
Hmmmm.... doh!
Thx splict, ...I even have a post in that thread hehehe. That will go along way I think, I'll have a looksee :).
CyanBlue
05-06-2004, 09:24 AM
Um... I don't think there is any that is 100% working, is there??? :(
Stimpson
05-06-2004, 09:27 AM
I sure hope so... nah, otherwise it will get me started on it no doubt.
splict
05-06-2004, 09:28 AM
Well, I just used that example because I wasn't sure (since Stimpson had a post in the thread ;) ) if that was the type of thing he was talking about or not. If that one doesn't work there are many others like in this post (http://www.actionscript.org/forums/showthread.php3?t=40699&highlight=xml+object+parse).
Or is it a fundemental problem with that method altogether?
-splict
Stimpson
05-06-2004, 09:34 AM
Not sure.. All I'm looking for is some sort of little nifty cript which parses any given xml doc (without knowing it's structure) into an object with the same tree structure and content... well that's the idea anyways hehe.
I'll take a closer look at those threads if they have something like that. Thx :).
CyanBlue
05-06-2004, 09:41 AM
Hm... XMLtoObject... I use this one most of the times... :)
XMLtoObject by Michelangelo
http://www.onrelease.org/index.php?m=200303#79769937
Stimpson
05-06-2004, 09:54 AM
Excellent CyanBlue!! That looks exactly like what I had in mind (and that wasn't pretty hehe)
..... geeezzz.. what's wrong with me, scripts everywhere. I must be losing it....
Thx all :).
Stimpson
05-06-2004, 09:57 AM
Arrgghh.... that XMLtoObject link is down.... can you give me a fix on that script CyanBlue?
Stimpson
05-06-2004, 10:14 AM
Ok..... never mind:
http://www.actionscript.org/forums/showthread.php3?t=45320 (last post)
I'll stop now :rolleyes: :D
CyanBlue
05-06-2004, 10:28 AM
Yeah... I think that's the same file... :D
Stimpson
05-06-2004, 10:45 AM
Yeah, shame it isn't AS 2 though, not that it really matters. Found this on it:
http://www.tweenpix.net/archives/000042.html
But my french is subzero, so perhaps I'll rework it myself (perhaps.... ;))
splict
05-06-2004, 11:16 AM
Thanks for the link, CyanBlue! Looks good. :) Stimpson, It should be fairly easy to write a 2.0 XMLObject class that would extend XML so that you could (if you had no use for the original XML object) just load the XML file into it and it would be the object. Sounds handy.
CyanBlue, how much luck have you had with this for complex files and Flash's slow parsing of strings and xml?
Stimpson
05-06-2004, 11:59 AM
Yeah, not even a reason to extend XML I guess. Just a class which accepts a xml url in it's constructor, and returns the parsed object....excellent :).
CyanBlue
05-06-2004, 01:09 PM
Well... I did not really used very very extensive XML cuz I don't like XML very much... :D
But this site, https://www.steadyhosting.net/ , uses reasonable amount of XML...
Tell me how slow or how fast it is for you... I think the parsing speed on this site is not really an issue... What do you think??? :)
CyanBlue
05-06-2004, 01:10 PM
Yeah, not even a reason to extend XML I guess. Just a class which accepts a xml url in it's constructor, and returns the parsed object....excellent :).
Hm... That sounds like a good one to try with AMFPHP... Though, it sounds abit of overkill for that... :)
CyanBlue
05-06-2004, 01:47 PM
Oh... Found the XML files...
Just in case how big of XML file I was using... :)
At the bottom of the page, there are Terms of Service and Acceptable Use Policy which are linked to...
https://www.steadyhosting.net/texts/aup.xml
https://www.steadyhosting.net/texts/tos.xml
Most of the menus loads XML files as well... I just can't remember the URL for them... :)
Stimpson
05-06-2004, 01:49 PM
I did not really used very very extensive XML cuz I don't like XML very much... :eek: (Wash your mouth young man!! :D)
Tell me how slow or how fast it is for youYou're doing fine there, runs great on my end (..now that just sounded wrong....). Just a barely noticable timegap befor the text appears.
That sounds like a good one to try with AMFPHPHmm.... interesting, that would make a nifty little webservice me thinks... :cool:.
CyanBlue
05-06-2004, 01:55 PM
Yup... Great webservice indeed... The only problem would be how useful it is going to be... It'd be fine when the connection speed is good, but if the connection is bad, it might take more than the actual parsing time in Flash... :D
Glad to hear that it isn't that bad... I probably had to use Flash Remoting to do that job to speed up the process... Nah... I should really just hard code all the texts... :D
Stimpson
05-06-2004, 02:01 PM
Yeah, connection speed would be key.. I myself have zero to none experience with these things though... doh!
Nothing wrong with hardcoding the text, if they wont need to change that is hehe.
CyanBlue
05-06-2004, 02:04 PM
True... But that's hardly the case... Lots of clients wnats to modify/update the site whether they know what the computer is or not... :(
(Not saying that the above client is though... He's very savvy computer user...)
Stimpson
05-06-2004, 02:09 PM
Yeah...pesky clients always... It's because they pay, but otherwise... oh wait IT IS beacuse they pay :rolleyes:.
CyanBlue
05-06-2004, 02:11 PM
Hahaha... That's true... :)
So, did you test the one that you got???
And, do you HAVE TO convert it to AS 2.0??? You cannot use it as it is??? (Just curious...)
Stimpson
05-06-2004, 02:18 PM
Oh yeah, it worked great. Excellent, just what I needed :).
Well I noticed some hickups before mixing AS1 and AS2 OOP (probably just me not handling it right hehe), and the project is AS 2. So there goes... another example of reworking something which works great already, ah well :rolleyes:.
CyanBlue
05-06-2004, 02:24 PM
Ah... I see... :)
Go to babelfish and translate that tweenpix page to see if it makes more sense...
I think that's faster... :)
Stimpson
05-06-2004, 02:28 PM
Hmmmmm...... intreging option... :D
CyanBlue
05-06-2004, 02:30 PM
Yeah... There is no reason to reinvent the whole thing again when there is something you can just touch up and utilize it for your own project... :)
Stimpson
05-06-2004, 02:36 PM
Yep, so true. But wouldn't mind to get my feet dirty on this so to speak. Ah well, I'll just see. If it's to much hassle I'll go at it with that french link like there's no tommorow.... :cool:.
CyanBlue
05-06-2004, 02:46 PM
Yeah... I know... There is nothing wrong with trying to get your hands dirty... That's how we learn, right??? But if that's something you should do in hurry, you've got to do what you got to do to finish the project... That's all... :)
(Um... Is there tomorrow anyways??? :D)
Stimpson
05-06-2004, 02:53 PM
Hurry.........??? Nope, never heard of that. Some kind of fruit? :D
CyanBlue
05-06-2004, 02:56 PM
Hehe... Yeah, right... I've got to go back before I get fired... :D
Stimpson
05-06-2004, 03:02 PM
Hmmm..yeah, got to keep paying them bills... work well :).
CyanBlue
05-06-2004, 04:15 PM
Can't... My brain is no workie... :(
CyanBlue
05-07-2004, 09:47 AM
Not sure how much this will help you but here is another one that looks like it might do the job for you as well...
http://downloads.junioronline.us/details.php?section=2&item=44
Stimpson
05-07-2004, 02:02 PM
Hey great! Actually that other code sits already comfy in i't's AS 2 class, wasn't much hassle. I'll post it later when I brushed it up a bit. I'm gonna take a look at that XML-connector though, it might be usefull :D.
CyanBlue
05-07-2004, 03:06 PM
Hm... Okay... I don't think I'll be bothering you with that for some time, but yeah... make them handy and have them all worked out... In the mean time, make several versions of webservices and AMFPHP versions as well... :D :p
BTW, what the !@#$ is that XML connector??? Is it something for FMX 2004 only stuff??? I've never heard of that before... :D
Korona
05-07-2004, 03:52 PM
lol, sorry for the late reply, but i made an XML serializer 2-3 months ago, in AS2. it hasnt been doing much except sitting on my HD, the project it was for fell through the floor (im doing it in c# instead). but anyway, if youve already made one yourself...
;)
Stimpson
05-07-2004, 04:26 PM
Well....adepted one for AS2..that's all hehe :rolleyes:. Works great though, thx anyways :)
XML connector...I've never heard of that before...Dude...wasn't that in that link you gave 3 posts down the road :D. I could just be delerious though, you know how that goes on a friday night (*cough*).
hipster
06-25-2004, 08:32 AM
Hello people,
was wondering if any of you guys know how to access the data inside the xml connector once you read the xml in. I can hook the connector up to all sorts of components...but I need to make some of the data variables. Does anyone know the syntax for this. I've looked all over the forums here and macromedia...everyone is asking...nobody knows though.
cheers,
morgan
georgeatef
07-10-2004, 02:57 PM
Hi all,
This link will be very useful:
http://www.macromedia.com/devnet/mx/flash/articles/xmlconnector.html
but i have a problem, that link shows databinding and using xml connector and Schema for getting results from XML file depending on the user choice from a comboBox, but what if i want a user to type a part of a word in an input text box then press SUBMIT to access XML data, how can i do it?
any ideas, suggestions or tutorials?
Thanks.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.