PDA

View Full Version : checking if a file exists-> with a twist


hangalot
11-30-2004, 05:31 PM
hi all

i must admit this is a very frustrating thing i am encountering.
some background:

I want to check that all my resources exist b4 i start an application, so i create an associative array [hash map] of all the files i want to load (during the course of the application) and using an xml object (the reason for this will become apparent in a second) i basically do a load call on these resources.
obviously if the success variable is false the resource is not there. aah, here comes the trick. we do a do a get call on these resources via a jsp page, this servletl, when the resource is not there returns a piece of xml (hence the xml object).

so no 404 error and thus no success==false.
now i can parse this xml and realise that check what the nodeName is or if there is a firstchild-> whatever.
so i try this and when loading in a swf with the xml object i get the following


trace("xml status"+ this.status + "::"+this.firstChild);

that trace returns:
xml status0::FWS(E
watta fck. i am thinking how can a swf be parsed by the xml parser and return a status ==0 and a firstNode!!!

so i decide to use the this.firstChild.nodeName wh9ich in turn returns a null if it is not an xml file (yeah the document element has no name!!!) but still wtf. this seems a rather inelegant sollution to me.

any suggestions on how to make this slightly more ...sane...?