Name:
Location: Columbus, Ohio, United States

Tuesday, October 26, 2004

Using GRML


Creating files and web pages using GRML.

Introduction

This article explains the tags, syntax, and format of GRML 2.0 (General Reuse Markup Language), a data defintion markup language. This contrasts HTML, PDF, or other display-oriented formats or markup languages. GRML is similar to the CSV format or XML, because it focuses on content structure, rather than content display.

Web browsing is possible with GRML because it uses ASCII text, the same as HTML. Just as there are web browsers for HTML, the same is true for GRML. Both use web servers, text, images, and hyperlinks. They both use static and dynamic web pages. Both support ASP, .NET, CGI, PHP, or JSP. They both use the web, but in different ways.

Background.

Before using GRML, it is important to know how it differs from other formats and markup languages. Introducing GRML describes the circumstances for creating the markup langauge and covers its strengths and weaknesses. It is recommended to read it first.

To understand its history, read Understanding GRML. It describes the path taken to arrive at GRML 2.0. It sets the timeframe and requirements for developing the latest version of the markup language.

Getting Started.

First, it is important to understand what GRML is and what it is not.

GRML is not for:
  • unstructured data (e.g., articles, stories, letters);
GRML is for:
  • structured data (e.g. databases, spreadsheets, or character-delimited files);
  • web data (e.g. search engines, news headlines, auction listings, etc.);
  • dimensional data (e.g. forecasting, modeling, time series, etc.);
  • links (files);
  • hyperlinks (web pages); and,
  • images.
Knowing the type of content GRML handles, the next step is to examine the tags used to create input controls, columns, and results.

Tag types.

GRML uses form tags and view tags. The form tags create the input controls in a viewer (viewers display content from GRML files or web pages). The view tags create columns and results.

Every tag supports a name. For form tags, the name is used to associate a value to the input control when sending a request. When it is a view tag, the name is used to create a dimension (i.e. group) of columns and results. While a name is required for form tags, it is optional for view tags.

When GRML reads a line, the tag is read first. All tags use a parent-child relationship to specify values. The parent tag defines the type of tag, whether input control, column or result. Each child tag sets the attributes. Parent tags have closing tags and may use a name. Child tags do not have closing tags and do not use a name.

All tags reside on one line. Once the end of the line is reached, the next tag is read. Once a parent tag is read, everything else on that line is ignored. Child tags are read using an <attribute>value pair. Once the carriage-return or line-feed is reached, the attribute value is set and the next tag is read.

Form tags.

The following shows parent-child form tags.

<edit url1>
<title>Enter URL:
<text>http://127.0.0.1
</edit>

The above GRML creates an edit input control with a name of url1. It has a title of Enter URL: and it displays http://127.0.0.1 in its input area. The parent tag is <edit url1> and the child tags are <title> and <text>.

There are other input controls using form tags, such as combo boxes, list boxes, calendar controls, spin controls, or radio buttons. They all follow the same pattern.

The following creates a submit input control.

<GRML>
<edit url1>
<title>Enter URL:
<text>http://127.0.0.1
</edit>

<submit>
<location>GRMLBrowser.com/webpages/rss.asp
<text>Submit
</submit>
</GRML>

A form tag is used to add a submit button input control. Without it, there is no way to send a form request. Submit has a location attribute, which determines where the form values are sent. In this case, the request is sent to GRMLBrowser.com/webpages/rss.asp. Notice, there are no end tags for any of the <attribute>value pairs.

These are some form tags supported by Pioneer Report MDI.

<edit name> Parent
<text> (sets the input value)
<title> (sets the label)
</edit>

<combo name1> Parent
<item> (sets item value)
<title> (sets the label)
</combo>

<submit>
<location> (sets the form destination)
<text> (sets the button text)
<title> (sets the label)
</submit>

<dimension>
<name> (not covered in this article)
</dimension>

These tags and <attribute>value pairs are form tags. The next step is to create columns and results, with view tags.

View tags.

There are two types of view parent tags, column and result. Each supports a name, when using dimensions. Since dimensions are not covered here, only tags without a name are discussed.

When creating columns in GRML, a column order is defined. The column order is the order of <attribute>value pairs using the column parent tag. It is called a column order because a viewer displays each column in descending order as it appears in the column parent tag.

<GRML>
<column>
<
MyFirstColumn>
<Another column>
</column>
</GRML>

Two columns are created using view tags. The first column is MyFirstColumn. The second is Another column. No results are shown because none have been added. To add results, using the column order above, the result parent tag is used.

<GRML>
<column>
<
MyFirstColumn>
<Another column>
</column>

<result>

<MyFirstColumn>Hello, world.
<Another column>This works!

</result>
</GRML>

A result has been added, containing two result items, using view tags. MyFirstColumn has the value Hello, world.. Another column has the value This works!.

With an understanding of the different tags used in GRML, it is now possible to understand what is happening in a GRML file or web page. The next section presents more ways to create input controls, columns, and results using form and view tags.

Examples.

There is more than one way to organize tags to create input controls, columns, and results. This allows a file or web page to organize its content in many different ways. The following two sections demonstrate these alternatives.

Form tag examples.

The form tags create input controls. Below are two examples for creating input controls in different ways.

Example 1.

<edit search1>
<Title>Request:
</edit>

<Combo Default>
<Title>Default location
<monster>monster
</combo>

<submit>
<location>GRMLBrowser.com/jobs.asp
</submit>

Example 2.

<edit search1>
<Title>Request:
</edit>

<Combo Default>
<Title>Default location
</combo>

<Combo Default>
<monster>monster
</combo>

<submit>
<location>GRMLBrowser.com/jobs.asp
</submit>

Example 1 has all attributes for an input control in one parent tag. Example 2 has one attribute for each parent tag. Both examples create the same input controls, though the tags are organized differently.

View tag examples.

View tags create columns and results.

Columns.

Use the column tag to set the column order of results. Below are two examples.

Example 1.

<column>
<Date Posted>
<Job Title>
<Job Location>
<Company>
<Search>
<DateTime>
<Link>
</column>

Example 2.

<column>
<Date Posted>
<Job Title>
<Job Location>
<Company>
<Search>
</column>

<column>
<DateTime>
<Link>
</column>

Example 1 has all attributes using one column parent tag. Example 2 splits the attributes in two, each using a column parent tag. Both examples create the same column order.

Results.

Having created columns, the next step is to add results. This requires the result parent tag. Below are two examples for adding results to the above column order.

Example 1.

<result>
<Date Posted>Jul 28
<Job Title>Sr. Java Software Engineer
<Job Location>US-CA-La Jolla
<Company>Company A
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1

<Date Posted>Jul 20
<Job Title>Web Development Analyst
<Job Location>US-WI-La Crosse
<Company>Company B
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1

<Date Posted>Aug 2
<Job Title>Software Group Manager
<Job Location>US-CA-La Mirada
<Company>Company C
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1
</result>

Example 2.

<result>
<Date Posted>Jul 28
<Job Title>Sr. Java Software Engineer
<Job Location>US-CA-La Jolla
<Company>Company A
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1
</result>

<result>
<Date Posted>Jul 20
<Job Title>Web Development Analyst
<Job Location>US-WI-La Crosse
<Company>Company B
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1
</result>

<result>
<Date Posted>Aug 2
<Job Title>Software Group Manager
<Job Location>US-CA-La Mirada
<Company>Company C
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1
</result>

Example 1 has all results using one result parent tag. Example 2 splits the attributes using multiple result parent tags. Both examples create the same results.

Putting it all together.

When a column parent tag is read, the child tags create the column order. This determines the order of display of columns. When a result parent tag is read, the child tags are added if the attribute exists in the column order.

Each item is added as it is encountered. The top column in the column order displays first. The bottom displays last. This is true for results. The top result with an attribute in the column order displays first. The bottom result with an attribute in the column order displays last.

Below are the combined form and view tags for the two examples.

Example 1.

<grml>
<edit search1>
<Title>Request:
</edit>

<Combo Default>
<Title>Default location
<monster>monster
</combo>

<submit>
<location>GRMLBrowser.com/jobs.asp
</submit>

<column>
<Date Posted>
<Job Title>
<Job Location>
<Company>
<Search>
<DateTime>
<Link>
</column>

<result>
<Date Posted>Jul 28
<Job Title>Sr. Java Software Engineer
<Job Location>US-CA-La Jolla
<Company>Company A
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1

<Date Posted>Jul 20
<Job Title>Web Development Analyst
<Job Location>US-WI-La Crosse
<Company>Company B
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1

<Date Posted>Aug 2
<Job Title>Software Group Manager
<Job Location>US-CA-La Mirada
<Company>Company C
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1
</result>
</grml>

Example 2.

<grml>
<edit search1>
<Title>Request:
</edit>

<Combo Default>
<Title>Default location
</combo>

<Combo Default>
<monster>monster
</combo>

<submit>
<location>GRMLBrowser.com/jobs.asp
</submit>

<column>
<Date Posted>
<Job Title>
<Job Location>
<Company>
<Search>
</column>

<column>
<DateTime>
<Link Location>
</column>

<result>
<Date Posted>Jul 28
<Job Title>Sr. Java Software Engineer
<Job Location>US-CA-La Jolla
<Company>Company A
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1
</result>

<result>
<Date Posted>Jul 20
<Job Title>Web Development Analyst
<Job Location>US-WI-La Crosse
<Company>Company B
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1
</result>

<result>
<Date Posted>Aug 2
<Job Title>Software Group Manager
<Job Location>US-CA-La Mirada
<Company>Company C
<Search>Java LA
<DateTime>Today
<link>http://127.0.0.1
</result>
</grml>

The above examples demonstrate the different ways to organize GRML to create the same input controls, columns, and results.

Scope of use.

Some GRML viewers do not display columns. It may only display images, or links, or partial text. For example, Pioneer Report MDI uses its thumbnail view to display an image and a result item appearing first in the column order. However, all GRML files or web pages require columns, if results are displayed.

Now that it has been shown how GRML uses input controls, columns, and results, it is possible to use the above example to create just about any type of GRML file or web page. There are form tags for handling user input and sending requests. There are view tags to display file or web page columns and results.

The only limitation of the above GRML is it does not demonstrate dimension tags. It is a topic discussed in another article. To respond to a request submitted using input controls, server-side processing is required. A server-side scripting, or programming language, such as ASP, JSP, CGI, .NET or PHP is needed. These techniques are discussed in another article.

Conclusion.

Well, that is it. It was shown that all GRML files and web pages consist of two types of tags. One is the form tag, for creating input controls. The other is the view tag for creating columns and results. There are parent tags to create input controls, a column, or a result. And, there are child tags to set the attributes of the parent tags. Only parent tags have end tags, while child tags do not.

Knowing the different tags in a GRML file or web page provides the basis for learning other aspects of the markup language. Once familiar with the different tags, the next step is to learn how to use server-side processing with form requests and how to use the dimension tag.

To get all the information available for GRML on the web, visit GRML, CSV, and delimited file and web browsers with product descriptions.

0 Comments:

Post a Comment

<< Home