Script that parses XML - Sample wanted

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
THEMike
Posts: 13
Joined: 2006-07-11 17:51:16

Script that parses XML - Sample wanted

Post by THEMike »

I'm looking for an example script that parses XML returned from a website.

I'm sick of the Amazon script not working, and the lack of a .co.uk variant and since I already have an Amazon WS developer key, I'm going to produce a global amazon, WS based, data retrieval script. But I'd like an example of handling XML to work off.

(I'm an ex-delphi programmer, use XML a lot, but never from Delphi and never with the lib that the script library has access to).
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I think that the only script that handles XML is the "dvdfr" script.
THEMike
Posts: 13
Joined: 2006-07-11 17:51:16

Post by THEMike »

Cheers, is there any documentation of the comment header?
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

That is at the top of all scripts? No, but you do not have to edit it manually: its content is modifiable throught the "Properties" window of the script editor (one of the buttons in the Editor window)
THEMike
Posts: 13
Joined: 2006-07-11 17:51:16

Post by THEMike »

Yeah, that is what I meant. Ok Cheers.

I'm working in my favourite programmers editor instead of the script editor, so hadn't noticed.

I'd like to request an API to set the parameters, there is one to read them, and a way of setting persistent info. I'd like my script to be able to prompt the user to confirm/set their initial settings on first run.

My script supports all flavours of Amazon, so on first run I'd like them to select which one to work with rather than default to .co.uk. I also have a couple of other options which I'd like to highlight to the user and get a first cut of settings.

Cheers,

Mike
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

You can use GetStatic & SetStatic functions:

Code: Select all

procedure SetStatic(AName: string; AValue: string);
function GetStatic(AName: string): string;
The value is stored in Scripts.ini
THEMike
Posts: 13
Joined: 2006-07-11 17:51:16

Post by THEMike »

I'm aware of the statics, but I'd like to do:

if GetStatic('SettingsMade') = '' then begin
// render a pick list for each of the three critical options.
// then call new SetOption() function to set those options.
SetStatic('SettingsMade') = '1';
end;

Then use GetOption() to retreive the settings, thus allowing the user to change the Options at any time without having to do an intrusive, do you want to change options? Dialog and abuse Get/SetStatic.
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Well, currently you cannot really do that unfortunately.
THEMike
Posts: 13
Joined: 2006-07-11 17:51:16

Post by THEMike »

Yes, I'm aware of that, I was requesting it as a future feature.

My amazon script has been posted as a [BETA] [REL], and I've just used it to replace the rubbish IMDB images in 300 odd films with nice UK DVD covers from amazon.co.uk
Post Reply