It might be easier to check for the address in your html element. E.g., use the javascript indexOf method to look for "1195 " in your example. Including the space at the end of the number is important to exclude the occurence in lat/lng values. If you get more than one result, check those for street name or venue name.
On May 16, 3:19 am, stillepost <[email protected]> wrote: > OK. I've approached this problem with limited Javascript and XML > experience so I'm hitting a wall fairly early on. I'll describe my > problem, and if anyone can help it'd be great. I know this may not be > the most appropriate forum for my question, though, so I apologize in > advance for asking. > > This is the kind of string I get from my calendar, for the venue: > > SAT (Societé des arts technologiques), 1195 St-Laurent > > Note that the venue may have accented characters in it. > > This is the entry in my XML file for this particular venue: > > <marker label="SAT (La Soci&eacute;t&eacute; des arts > technologiques)" html="<img style="float:left;padding: > 2px;border:1px double #999;margin-right:12px;" width=" > 90" height="67" src="http://base.googlehosted.com/ > base_media?q=LBC-4808530-1525157559&size=2&hl=en" / > ><strong><a href="http://www.sat.qc.ca">SAT > (La Soci&eacute;t&eacute; des arts technologiques)</ > a></strong><br />1195 boul St-Laurent<br />(514) > 844-2033" lat="45.509445" lng="-73.562714" /> > > Note that in the XML file, all the accented characters, plus the < and > > > and & and " must be encoded. > > What I need to do: > > 1. Obtain the venue name from the event page. (I'll call it > $venuename.) This is trivial either in PHP (because it's already used > in creating the page ) or Javascript (via getElementById) > > 2. Open my XML file > > 3. Encode $venuename with the appropriate entities (because it comes > from the calendar unencoded and thus won't match the XML file) > > 4. Search within the XML file to find a match between $venuename and > the element marker's attribute named "label". > > 5. - If match is found, return the entire element with that marker to > the script, then create the map with it. > 5. - If no match is found, return nothing and don't create a map > > 6. Close XML file > > I've been reading about various XML parsers and about Javascript text > processing and I'm at a loss about which to use. For the past 5+ years > I've mostly worked with other people's scripts, and haven't written > anything from the ground-up for a long time. This is where I'm at > right now: > > - In my entry page (PHP script), I can either insert the Javascript > into the resulting page, doing all the opening/reading/comparing > $venuename/returning the entire XML element/outputting the map in > Javascript. OR I can open and read and compare and return the XML > element in PHP, and insert the result into a bit of Javascript that > just creates the map. > > - I'm a bit lost, I guess, because I've never really worked with XML > before. I know there are parsers and such but I'm unfamiliar with how > they work. > > - I think the problem is less about not knowing Javascript (I could > probably just look for equivalent functions to languages I already > know) but about not knowing how XML is processed. > > - I'm sure if I think this out long enough I'll figure something out, > but I don't know much about best-practices wrt Javascript *or* XML > > - I seem to only work on this project when I'm lacking sleep. > > - My skills really needed to be brought out of the dark ages and > introduced to OOP and frameworks and browser-based stuff anyway, so it > will be good for me to learn this stuff somehow. > > - I know this is my own fault for getting in over my head so I > apologize again for inappropriate or stupid questions! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
