Main > Everything Else
Need some XML help
shmokes:
I've just installed a photo-viewing app on my website that I really like, but I'm having one problem that I think is pretty minor and maybe someone here can help me. The app itself is freeware and it's made by a guy with very poor English. I really don't think I can get any help from him (not to mention that he provides it free of charge and I don't think he wants to provide technical support to thousands of people like me. Anyway . . .
The app has an administration component where I can upload photos one at a time, but that's not going to work for my purposes. I need to be able to get a batch job of like 400 photos transferring over FTP at one time and go to bed.
To that end, I've got a PICASA template/script that will generate thumbnails and the XML file necessary for the photo gallery, but the XML file it's creating isn't exactly what I need. It is generating files that look like this:
--- Quote ---
<SIMPLEVIEWER_DATA imagePath="./Test/images/" thumbPath="./Test/thumbs/" maxImageDimension="480" textColor="0xFFFFFF" frameColor="0xFFFFFF" backgroundColor="0x456789" frameWidth="20" stagePadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="right" navDirection="LTR" isPublished="true" title="Test">
<IMAGE>
<NAME>graduation.jpg</NAME>
<CAPTION>graduation.jpg</CAPTION>
</IMAGE>
<IMAGE>
<NAME>myspace.jpg</NAME>
<CAPTION>myspace.jpg</CAPTION>
</IMAGE>
<IMAGE>
<NAME>luna.jpg</NAME>
<CAPTION>luna.jpg</CAPTION>
</IMAGE>
<IMAGE>
<NAME>crying_kid.jpg</NAME>
<CAPTION>crying_kid.jpg</CAPTION>
</IMAGE>
</SIMPLEVIEWER_DATA>
</SIMPLEVIEWER_DATA>
--- End quote ---
But I need it to make files that look like this:
--- Quote ---
<SIMPLEVIEWER_DATA imagePath="./Test/images/" thumbPath="./Test/thumbs/" maxImageDimension="480" textColor="0xFFFFFF" frameColor="0xFFFFFF" backgroundColor="0x456789" frameWidth="20" stagePadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="right" navDirection="LTR" isPublished="true" title="Test">
<IMAGE>
<NAME>Luna.jpg</NAME>
<CAPTION><![CDATA[<a href="./Test/images/Luna.jpg" target="_blank"><u>Open image in new window</u></a>]]></CAPTION>
</IMAGE>
<IMAGE>
<NAME>graduation.JPG</NAME>
<CAPTION><![CDATA[<a href="./Test/images/graduation.JPG" target="_blank"><u>Open image in new window</u></a>]]></CAPTION>
</IMAGE>
<IMAGE>
<NAME>crying_kid.jpg</NAME>
<CAPTION><![CDATA[<a href="./Test/images/crying_kid.jpg" target="_blank"><u>Open image in new window</u></a>]]></CAPTION>
</IMAGE>
<IMAGE>
<NAME>myspace.jpg</NAME>
<CAPTION><![CDATA[]]></CAPTION>
</IMAGE>
</SIMPLEVIEWER_DATA>
--- End quote ---
As you can see, the problem is the stuff between the caption tags. But I don't know what any of that stuff is so I don't know how to fix the Picassa template so that it will create the files correctly. Here is the line in the Picasa template responsible for that line:
--- Quote ---
<image>
<NAME><%itemName%></NAME>
<CAPTION><%itemCaption%></CAPTION>
</image>
--- End quote ---
Is it immediately obvious how I can change the info in this last quote so that it will create XML files properly for me? If you have any interest in lending a hand, but need more info, like all the files from the Picasa template so you can see how it works, let me know.
Thanks.
JamIt:
I've never worked with PICASA, but have you tried:
<image>
<NAME><%itemName%></NAME>
<CAPTION><![CDATA[<a href="./Test/images/<%itemCaption%>" target="_blank"><u>Open image in new window</u></a>]]></CAPTION>
</image>
Hope this helps,
JamIt
patrickl:
I'd say the above should work, but otherwise just do a search and replace in Word or something.
Replace <CAPTION> with <CAPTION><![CDATA[<a href="./Test/images/
and </CAPTION> with " target="_blank"><u>Open image in new window</u></a>]]></CAPTION>
shock_:
yeah what patrickl said.
Any text editor like notepad should do a find/replace.
That stuff, in case you care, is the HTML the image viewer will use to put links on your images. It's going to open them in a new window when you click them, too. If you don't want that, change "_blank" to "_top"
Also note that the way things look there, you'll have to ftp your files to a directory under where that image viewer lives on your site (specifically <your page>/Test/images/ ). If you want/need them living somewhere else, try changing that part of the code in the XML.
The <![CDATA[ and ]]> parts are just there to help your image viewer not crash... they tell it to safely ignore anything that looks like more XML between those two end points and not try and parse it. XML is funny like that :)
And one last thing - it's just a guess, but it looks like you could safely rename all the <NAME>blah</NAME> stuff to be nice readable English words rather than just the filename - assuming that's for printing under the thumbnails or something.
Good luck
shmokes:
Thanks guys. I'll give it a shot when I get home. This whole thing had abominable documentation (almost none) and what was there was in broken English. Couple that with my nonexistent skills and experience with web servers and it creates the situation I was in yesterday where I got everything finally working after quite a few hours of trial and error. This is my very last hurdle and I think I'll be good to go, so thanks a lot.
p.s. also, don't take my troubles above to be criticism of the author of the software. He is obviously awesome and under no obligation whatsoever to even release it to the public to begin with, let alone extensively document it in a language he barely speaks :)
Navigation
[0] Message Index
[#] Next page
Go to full version