You are hereAria User Guide / Section III: In Depth / Importing HTML
Importing HTML
Aria allows HTML files to be opened and saved as Aria xml files. This import facility provides a means of working with existing web applications and enabling an upgrade to Aria and Aria.
One size doesn't fit all and while Aria and Aria applications may not be for everyone, it is equally true that vanilla HTML applications, or even Ajax enabled web applications are not adequate for all situations. Where web applications are insufficient you may want to provide an upgrade path for power users or users who's requirements differ from the norm.
Aria and Aria already support multiple widget sets, so they can be used to target a wide variety of platforms. The HTML widget support discussed earlier is one means of supporting lightweight clients via web browsers, but it is still reliant on the web browser and is therefore limit to what that browser can do. Furthermore the security and compatibility issues faced by the browser may not be acceptable by everyone.
To address these situations and to provide a means of processing HTML Forms, Aria has the capacityto import HTML pages and save them as Aria XML files. Once imported the pages can be manipulates as any other Aria page.
Opening HTML within the IDE
The html import facility within the editor is enabled by default and all you need do is locate and open an HTML file within the files view. As the file is opened it is parsed and a Aria representation is built.
Not that the W3C HTML 4.0 standard is used when processing the HTML and therefore not everything that can be rendered in the latest web browsers will be importable.
Once the file has been imported and displayed you can begin to edit the files. (When you save the file a new file with the
.xml
extension is created instead of overwriting the original html file). Because of the layout limitations inherent in HTML many HTML pages will have redundant element and redundant objects for formatting and you may want to remove as much of this redundancy as possible, however if you anticipate tracking updates to the original HTML files you may not wish to make such changes.
During the import process the JavaScript contained in the HTML is imported and method stubs are created for the event handlers that will be needed to replicate the HTML's behavior. A comment containing the original JavaScript code is added within the stub of each event handler.
Using the HtmlBuilder
In fact the import facility is not restricted to the IDE, it can be used at any point within Aria by adding a
BuilderClass
property to the
startup properties
file:
Setting up the HtmlBuilder
BuilderClass=org.formaria.builder.w3c.html.HtmlBuilder</P> </TD> </TR> <TR> <TD > <P> NumBuilderClasses=2 BuilderClass0=org.formaria.builder.AriaBuilder BuilderClass1=org.formaria.builder.w3c.html.HtmlBuilder
Customizing the HtmlBuilder
The
HtmlBuilder
is designed to be customizable, right down to the level of processing individual HTML tags. The builder contains a table of tag handlers, each of which is a prototype for the handler that processes the various element types recognized by the html parser. Therefore, by replacing the prototype instance with a custom one you can add custom processing.
- Printer-friendly version
- Login or register to post comments