suites.xmlMenuThe purpose of this set of commands is to give you a workspace for XML inside the Frontier enviroment.
Until 5.1.3, XML was lurking in the background. It's the basic technology that makes XML-RPC possible, but in that role it's largely invisible. There's rarely a need to look at the XML tagged text that's transmitted between networked Frontiers.
Now, we approach it from the other side. What is it like to work with XML text and structures in the Frontier environment? In this suite we phrase the question in the form of a new table, user.xmlMenu, and a menu with commands that do interesting things with XML.
This is not presented as a complete toolkit for XML work in Frontier, but it's a step in that direction.
To run this suite you need Frontier 5.1.3 or greater. There were important fixes in that release that this suite builds on. Also, be sure you have the latest update, this suite calls a new verb, op.newOutlineObject, that was released on 8/16/98.
suites.xmlMenu will work with the Trial version of 5.1.3.
This is a fat page that contains suites.xmlMenu. To intall, run xmlMenu.initClient. It creates user.xmlMenu, which has four sub-tables, taggedText , outlines, structures, prefs and callbacks.
How it works
There are three equivalent forms of any XML object:
Each of these views has advantages over the others in different situations, the tagged-text version is the exchange format with other XML-compatible apps, the database structure is the one that scripts can use, and the outline representation makes it easy to browse and edit XML text.
The purpose of this suite is to make it easy to view and edit all three interpretations.
Try it out
First choose xmlMenu from the Suites sub-menu of Frontier's main menu.
From the Open Table sub-menu of the XML menu, choose Tagged Text.
Put the cursor on the first item in the table (as it ships), someComputer, you can open it and have a look:
Choose Generate Other Forms from the XML menu. Two windows open, showing the other forms of this object, the outline version:
and the structure version:
You can then make changes to any of the forms and use the Generate Other Forms command to bring the other forms into aggreement with the changes you've made.
Get from URL...
This command displays a dialog asking for a URL, it does an HTTP request, gets the text, and adds it to a cell in user.xmlMenu.taggedText, confirming if it's overwriting an existing cell. If user.xmlMenu.prefs.logURLs is true it adds the URL to user.xmlMenu.urlsOpened.
Get Latest Scripting News
This command calls an XML-RPC handler on betty.userland.com to find out what the latest Scripting News XML file is, and then gets that file from www.scripting.com, and generates the outline and structure form of it.
When you Generate Other Forms from a wptext object, if there's an XML syntax error, an error message is displayed in a dialog and the cursor moves to show you where the error was discovered.
There's a server side to this suite, we're running it on betty.userland.com. It may do other things in the future, but for now it has a single XML-RPC handler that returns the date of the most recent Scripting News XML file.
You can use this suite with another XML parsing facility such as Blox from Technology Solutions. To do so, add two scripts to user.xmlMenu.callbacks, one called compile, and another called decompile. They follow the conventions of UserLand's built-in XML routines. We did this so that people would know that we welcome other developers' work in this space.
When Generate Other Forms creates an outline it does it in a very simplistic way, using the tab-indentation of the text. If text values contain tabs or returns it will create an outline that does not truly reflect the XML, therefore it's not a good idea to generate the other forms from an outline without checking the outline first. The tagged text and table structures do represent the same structure.
The xmlMenu suite played a big role in our real-world testing of 5.1.3.