Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Need some XML help  (Read 1332 times)

0 Members and 1 Guest are viewing this topic.

shmokes

  • Just think of all the suffering in this world that could have been avoided had I just been a little better informed. :)
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10397
  • Last login:September 24, 2016, 06:50:42 pm
  • Don't tread on me.
    • Jake Moses
Need some XML help
« on: August 29, 2007, 02:33:57 am »
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>


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>


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>


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.

« Last Edit: August 29, 2007, 02:35:32 am by shmokes »
Check out my website for in-depth reviews of children's books, games, and educational apps for the iPad:

Best Kid iPad Apps

JamIt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 155
  • Last login:June 17, 2011, 03:27:07 pm
  • I want my own arcade controls!
Re: Need some XML help
« Reply #1 on: August 29, 2007, 08:41:50 am »
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 cannot know for certain which will be tastiest
  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4614
  • Last login:August 27, 2021, 09:25:30 am
  • Yo momma llama
    • PocketGalaga
Re: Need some XML help
« Reply #2 on: August 29, 2007, 08:48:40 am »
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>
This signature is intentionally left blank

shock_

  • Wiki Contributor
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 354
  • Last login:January 30, 2020, 06:23:29 pm
  • In Brisbane, it's GMT+10 all the time.
Re: Need some XML help
« Reply #3 on: August 29, 2007, 10:18:28 am »
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

  • Just think of all the suffering in this world that could have been avoided had I just been a little better informed. :)
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10397
  • Last login:September 24, 2016, 06:50:42 pm
  • Don't tread on me.
    • Jake Moses
Re: Need some XML help
« Reply #4 on: August 29, 2007, 10:27:52 am »
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 :)
Check out my website for in-depth reviews of children's books, games, and educational apps for the iPad:

Best Kid iPad Apps

ChadTower

  • Chief Kicker - Nobody's perfect, including me. Fantastic body.
  • Trade Count: (+12)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 38212
  • Last login:June 22, 2025, 04:57:38 pm
Re: Need some XML help
« Reply #5 on: August 29, 2007, 10:35:58 am »

What is it written in?  That's where I'd look... into the source code to find where that XML is being generated.

boykster

  • This thread makes my brain hurt worse than Vogon poetry....
  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1581
  • Last login:February 04, 2025, 10:07:57 pm
  • The cake is a lie!
Re: Need some XML help
« Reply #6 on: August 29, 2007, 12:59:47 pm »

What is it written in?  That's where I'd look... into the source code to find where that XML is being generated.

that's what I'd do to, but not everybody is a software developer  :D

ChadTower

  • Chief Kicker - Nobody's perfect, including me. Fantastic body.
  • Trade Count: (+12)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 38212
  • Last login:June 22, 2025, 04:57:38 pm
Re: Need some XML help
« Reply #7 on: August 29, 2007, 01:04:34 pm »

A decently written app will usually have enough commenting in a text parsing routine to be able to tell what it's doing, even if you don't understand quite how. If it's in a scripting language, that is.

shmokes

  • Just think of all the suffering in this world that could have been avoided had I just been a little better informed. :)
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10397
  • Last login:September 24, 2016, 06:50:42 pm
  • Don't tread on me.
    • Jake Moses
Re: Need some XML help
« Reply #8 on: August 29, 2007, 01:11:53 pm »
I'm almost positive that it's PHP.  I'd have to go back to the site and look again to be sure.  But, on the other hand, it's not the actual program that matters so much here as the desktop side programs that can generate photo galleries with thumbnails, such as the Picasa template or Photoshop script that I have.  Those could be written in anything (and the two clearly are written in different languages) so long as either one of them produces a folder with thumbs, a folder with images and an XML file pointing to them with all the proper syntax or wording or whatever you programming people would call it.

Anyway . . . I just got home so I'm going to give these suggestions a go and then report back.
Check out my website for in-depth reviews of children's books, games, and educational apps for the iPad:

Best Kid iPad Apps

shock_

  • Wiki Contributor
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 354
  • Last login:January 30, 2020, 06:23:29 pm
  • In Brisbane, it's GMT+10 all the time.
Re: Need some XML help
« Reply #9 on: August 29, 2007, 05:37:03 pm »

A decently written app will usually have enough commenting in a text parsing routine to be able to tell what it's doing, even if you don't understand quite how. If it's in a scripting language, that is.

No guarantees the comments are in English either, though :)

ChadTower

  • Chief Kicker - Nobody's perfect, including me. Fantastic body.
  • Trade Count: (+12)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 38212
  • Last login:June 22, 2025, 04:57:38 pm
Re: Need some XML help
« Reply #10 on: August 29, 2007, 06:00:00 pm »

shmokes speaks two languages.  He can translate a third with web apps.

shmokes

  • Just think of all the suffering in this world that could have been avoided had I just been a little better informed. :)
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10397
  • Last login:September 24, 2016, 06:50:42 pm
  • Don't tread on me.
    • Jake Moses
Re: Need some XML help
« Reply #11 on: August 29, 2007, 06:38:45 pm »
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

This works perfectly!  Actually, the solution is kind of a combination of this and some quick find/replace jobs.  This generates all the  images, but it also says that they are all in the Test folder.  Each folder represents a distinct gallery, so it's just a matter of finding and replacing "Test" with the name of whatever gallery I'm setting up, and then FTPing everything over there.

SOOOO Nice!  Without this I would have to upload images to the galleries one at a time through the included server-side admin app which would basically have made this program useless as I have hundreds and hundreds of photos I need to publish.

Thanks!
Check out my website for in-depth reviews of children's books, games, and educational apps for the iPad:

Best Kid iPad Apps