Hollywood - The Multimedia Application Layer
Over the following months I'll be posting some source code examples using my base:library which is available (as an older version which will be shortly updated) on OS4Depot.
The base:library contains many useful functions for creating:
* An AmigaOS-like GUI with buttons, string fields, numercial fields, option boxes and more.
* Extracting data from XML documents
* Check whether an application is installed on the user's system; via APPDIR:
* Check AISS version and available system libraries
* Check AmigaOS version, memory available and CPU
* Rounding numbers, seconds into hours, minutes and seconds, and similiar functions
* Dealing with ARexx calls
* Making use of the Ringhio notification system
* Password Masking
* URL Encoding/Decoding
* .. and lots more.
The first installment is available now:
Extracting data from XML documents
So now you know what it is in essence how can we start making use of this format in our projects.
Well as a quick example, if you were creating a game you may want to have a high score table. You only require two fields: Name and Score.
It is entirely up to you how you lay this information out - however the file should always start with the ?xml and pobjects lines.
- <?xml version="1.0" encoding="UTF-8"?>
- <pobjects version="1.0">
- <key>High Score Table</key>
- <string>Richard Lake</string>
- <string>Fred Bloggs</string>
Your always start extraction by skipping over the first 3 lines, in this example we are only defining 1 array so we can safely skip over the first 7 lines to begin at the line:
We then define a While....Wend block to extract the information from the the
XML documents can be as complex or simple as you wish, for example in application software you may wish the user to be able to save settings in different areas of the application. Instead of using multiple XML documents you can instead save everything into one single file and define an
<array> block to each application area.
In the source code provided the While...Wend block only performs extraction top to bottom and line by line with no structural validation taking place. Under normal circumstances, the end user should not have to manually edit XML documents, but XML documents are inheritly plain text so can be easily opened and edited within a simple text editor.
So if you were doing a game with a high score table you'd probably want to compress or encrypt the XML document in someway as well - Hollywood provide functions for this as well which go outside the scope of this blog.
Okay here is the source code example, I hope you will find it of some use in your future projects. Thanks for reading.
You can find out more writing software for Hollywood on the official forums: