FileMaker XML Technology Overview

by Elliotte Rusty Harold
- March 2000 -



EXECUTIVE SUMMARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 More Customizable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 Data Exchange Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 Publishing FileMaker Pro Data on the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 WHAT WHY

XML? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4 XML? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5


OTHER WEB SOLUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 Export as HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 Instant Web Publishing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6 Custom Web Publishing with Proprietary Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 Other Web APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 The XML Advantage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 HOW

FILEMAKER PRO SUPPORT XML? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8


FILEMAKER PRO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11

FMPDSORESULT, a database table-specific grammar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 FMPXMLRESULT, a database table-independent grammar . . . . . . . . . . . . . . . . . . . . . . . . . . .11 FMPXMLLAYOUT, a grammar for layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 FORMATTING XML DOCUMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 Formatting XML using CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Formatting XML using XSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 Scripting and the Document Object Model (JavaScript,VBScript) . . . . . . . . . . . . . . . . . . . . . . .15 Tools to help format XML documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 DEPLOYING A FILEMAKER PRO XML

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18

FURTHER READING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 GLOSSARY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20


XML lets FileMaker Pro send the information to the user more quickly and with less load on the web server. MORE CUSTOMIZABLE THE ADVANTAGES OF XML FOR FILEMAKER PRO WEB SERVERS XML offers many advantages to the FileMaker Pro developer who is serving data over the Web. The web browser shows the user a standard HTML form.database development. XML makes a very lightweight envelope to hold data so it's fast to read and fast to write. To that end. The server that uses XML performs faster. We believe it is extremely important that third-party independent developers gain a working knowledge of how XML technology can be leveraged for FileMaker Pro users. At this point the server's job is done. since what the client gets is more neatly organized as data than a typical HTML page.These sites and many others like them use FileMaker Pro’s built-in CGI or additional middleware products to connect their web pages to the underlying FileMaker Pro database. the data becomes far more usable and closer to its native format than it would be if it were first flattened into HTML. Inc. It can use JavaScript to sort or search the result set FileMaker Pro sent in real time.newspaper syndication. using XSL to transform into an agreed standard XML format. Many popular web sites are really just HTML views onto a FileMaker Pro database. It has other uses too. then inserting the results back into the HTML before sending it to the client. no prior knowledge of XML is assumed. the client can treat it as data. This Technology Overview shows you how to take advantage of XML to serve data-centric web pages from FileMaker Pro 5 or FileMaker Pro 5 Unlimited with a particular focus on how XML surpasses prior technologies for embedding data in web pages.The server can also send the browser a JavaScript program telling the browser how to make the data dynamic. is moving to support XML throughout its award-winning software product line. In addition. making those queries against the FileMaker database.) FileMaker. process has to be repeated. and then importing the data into the new database or 3 . Changing the display to sort by date instead of last name. HIGHER PERFORMANCE Serving data encoded in XML is faster because it lets FileMaker Pro do what databases are designed to do: store. that you're familiar with HTML. DATA EXCHANGE STANDARD XML isn't just for the Web either. but the other four are real examples. this requires the server to do a lot of work reading HTML files. if the client wants something changed.And. Then. is perhaps the most heavily hyped technology since Java. for instance having the results sorted by date instead of price.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML EXECUTIVE SUMMARY XML. though not necessarily version 5. Serving data in XML allocates server resources much more efficiently. It's an ideal format for sharing and exchanging data with third parties. And all of this can be done without bothering the server again with more requests! One request to FileMaker Pro gives the browser all the information the user needs.This is an inefficient use of limited server resources. Your data may be in a FileMaker Pro database but your customers or suppliers might use other databases. is more customizable. By using a web browser to format the XML and/or transform it into HTML. finding the database queries embedded in the files.You can move data from one system to the other by generating XML. Supplying a different style sheet or JavaScript program shows the user a different view of the data. you’re freeing up FileMaker Pro to accept more requests. It's been touted as the solution for a multitude of problems in fields as diverse as web page design. the Extensible Markup Language. As you'll see XML is an extremely convenient format for dynamically accessing FileMaker Pro data from the web or other databases and clients.These range from large sites like the FileMaker web store to relatively small operations. When using XML.The client then massages that data into a reasonable display and presents it to the user. so the user can sort or search it in real time. However. it's assumed you've worked with FileMaker Pro before. the entire The most common way to integrate XML with FileMaker Pro is through forms and style sheets. But just maybe XML really does live up to the hype. and that you've got some experience publishing web pages and sites. The user fills out and submits the form. which lets FileMaker Pro service a lot more requests in less time using the same network bandwidth. FileMaker Pro receives the form data and sends a response in XML that includes the data and the details about where a style sheet for the data can be found. maybe not in muskrat trapping. search and sort data. More of the work is shifted to the client. mortgage brokering. doesn’t have to require a new request to the database server and accompanying expensive round trip. However. The browser then retrieves a style sheet that tells it how to format the data for display to the user. for example.With XML. And by applying a simple style sheet or JavaScript you can make the data look and behave however you like. and can more easily exchange data with other databases. and it's ready to process the next request from some other client. Perhaps the single most important is raw speed. and muskrat trapping. (Well. FileMaker Pro only sends data to the browser.

and the ability to build and distribute stand-alone runtime copies of a database. is a W3C-endorsed standard for structured markup of documents and data. <person>. it removes the 10 IP address in twelve hour restriction and offers scalable load balancing and fault tolerance by using a Redundant Array of Inexpensive Computers (RAIC). <ID_Number>. All FileMaker Pro documents can be easily compared against DTDs or products support XML and can publish XML data on the Web. Closing tags begin with a </ and so forth.The FileMaker Web Companion can handle the various web services the machine provides. Clients don't need any browser plug-ins or special software.You get to validate the data your customers and supFileMaker Pro 5 is the entry level product designed for sinpliers are sending you before you store it in your database. enhanced layout design tools. However unlike HTML. or it can run in conjunction with a traditional web server like Apache. Figure 1: Exchanging data between databases using XML XSL processor transforms data into agreed format XML parser validates data Database imports data FileMaker Developer 5 includes FileMaker Pro 5 along with a variety of tools useful to professional database developers such as ODBC and JDBC drivers. and receiving the results back as XML. and of course XML. each running its own copy of FileMaker Pro 5 Unlimited WHAT IS XML? The Extensible Markup Language. The user can interact with the FileMaker Pro database using standard technologies like HTML forms. submitting it. a listing for a book might look like this: 4 . <sku>.You can define tags like <book>.FileMaker can also send a CSS or XSL style sheet or a JavaScript or VBScript program with the results to tell the browsers how best to format the data for display to the end user. Elements are delimited by start and end tags. in the future. while requests for dynamic data in XML format will be steered to the FileMaker Web Companion. Most importantly. Generally requests for static HTML files will be directed to the traditional web server. The most common way a user queries a FileMaker Pro database is by filling out a form in their browser. and more. DATA ON THE WEB FileMaker Pro 5 includes a plug-in web server called the FileMaker Web Companion. XML defines a syntax for a hierarchically structured text document divided into elements. its real advantage is that it can serve HTML and XML straight out of a FileMaker Pro database. limited to connections from no FileMaker Pro generates XML more than 10 unique IP addresses in PUBLISHING FILEMAKER PRO any twelve hour period. Client browsers like Netscape Mozilla and Internet Explorer connect to a web server running FileMaker Pro just like they connect to any other web server. FileMaker Developer 5 also includes the FileMaker Web Companion and is limited to connections from no more than 10 unique IP addresses in any twelve hour period. However. schemas to determine whether they adhere to the agreed-on format. <ROW>. XML examples and documentation. gle-user databases and small web sites.Additionally. This offers all the features of FileMaker Pro 5 including the FileMaker Web Companion and full XML support. JavaScript. <integer>. it needs to run on a machine that's connected to the Internet at a static domain name and IP address. For medium-to-high volume web sites. an FileMaker Pro software is available in several different varieties even more precise schema. the two servers will simply run on different ports.Attributes are provided in name="value" pairs in the start tag of an element. you'll probably want to move up to FileMaker Pro 5 Unlimited. up-to-the-minute information from the database. This format can be documented WHICH FILEMAKER PRODUCT IS RIGHT FOR YOU? using a document type definition (DTD) or. but is ness-to-business market segment. <DATA>.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML system as Figure 1 diagrams. <ERRORCODE>.These tags look superficially like HTML tags.This means that the browser always gets the most current. The data does not have to be exported and stored in static HTML files first. particular XML for different customers with different needs. If so. XML elements are not limited to a fixed set of tag names. that is they begin with a < and end with a >. Since the FileMaker Web Companion is a web server.This machine must have the database(s) users are browsing open. The FileMaker Web Companion can serve static HTML files and JPEG images just like a traditional web server like Apache. For example. in HTML. It includes the This is key for the expanding busiFileMaker Web Companion. XML for short.

Jerome <ul> <li>0140012133 <li>$6. Furthermore the elements don't overlap. However. wellformedness comes for free. The DTD very formally describes which elements are allowed in what contexts.gif width=87 height=140 align=left> <dt>Three Men in a Boat <dd>Jerome K.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML <img src=0140012133. 1998? And what happened on that date? All of this information should be easily ascertainable from the database. For instance. However. These are in addition to the well-formedness rules that must be adhered to by all XML documents. displaying. by documenting your XML application with a document type definition (DTD) and requiring that documents be valid according to the DTD. </year>. it not only checks to see that the document is well-formed.95 <li>1/3/1998 </ul> There's a lot missing from this listing. It helps avoid the browser compatibility wars that plagued HTML from its early days. they say nothing about how that data is formatted. XML retains not only the data.gif" width="87" height="140"></cover/> <price>$6. First. When you use FileMaker Pro to generate HTML. Chances are. but it's not so obvious from the HTML.95 should be a bullet point in a list. but rather an application of XML to a particular domain like book inventories or chemistry. from C to Java to Perl. the technical term is XML application. Jerome</author> <cover source="0140012133. a DTD is optional. These tools run the gamut from public domain to open source to fully supported payware. If you're mapping documents to databases. all the XML FileMaker Pro serves is well-formed without any extra effort on your part. a rental fee. whatever you're doing with XML. the shipping cost or something else? The last item looks suspiciously like a date. It also checks to see that every element in the document matches the declaration for that element in the document's DTD. part of the work has already been done for you and can be easily incorporated in your project at low cost and little effort. That is.95 a sale price. editing.The <month> tag can be contained in the • WHY USE XML? • XML offers many advantages to the FileMaker Pro developer who needs to send data to or receive data from non FileMaker Pro clients. This document is well-formed. By providing a DTD. but then there must also be a corresponding closing </month> tag in the year element as well. there has been an explosion of third party tools on many platforms in many languages for parsing. Firstly.This makes it much easier to write software that processes XML and to exchange XML documents between FileMaker Pro and other software.When a validating parser reads an XML document.There are no opening <book> or <year> or <isbn> tags without corresponding closing </book>. but is that date January 3. Applications that read XML documents are required to reject malformed documents. You can go beyond simple well-formedness. so you don't have to spend a lot of effort wor-rying about the detailed rules of wellformedness. all tags that are opened ar eventually closed. It says that there is a book with the title Three Men in a Boat and the author Jerome K. The set of possible documents with a given group of elements is sometimes called an XML vocabulary or XML grammar.95</price> <publication_date> <month>1</month> <day>3</day> <year>1998</year> </publication_date> </book> year element. from Macintosh to Unix to Windows. you don't need to use one. Jerome. is this a book or a video? What is the rather mysterious number 0140012133? Is $6.They are not allowed to try to fix the mistake and go on. you add rules that are specific to your document type. exchanging and validating XML documents. It says that the price is $6. XML tags add structure and semantics to the data in a document. There are several points to consider in this example: • The tag names tell you what's inside the tag.That means that it adheres to several rules. The DTD can be embedded in the XML document or stored in a separate file. but can also reveal the meta-data about what the data is. Formatting is applied later via a style sheet. whichever is more convenient.95. However.but it doesn't say that $6. XML retains not only the field values but in some cases. and </isbn> tags. This is not an application like FileMaker Pro or Internet Explorer that uses XML. 5 . in XML the same listing would look something like this: <book isbn="0140012133"> <title>Three Men in a Boat</title> <author>Jerome K. but it doesn't say that the title should be 14-point Helvetica bold. Different style sheets can change the presentation of the data without affecting the underlying document.However. This XML sample says absolutely nothing about how the book record is to be displayed to the reader. 1998 or March 1. the field names as well. If it isn’t useful to you.

(This approach works equally well for exporting data to an XML vocabulary other than one of the three FileMaker Pro natively supports. slowly changing sites. but give them a link or button to select the next ten records. Java Server Pages (JSP).TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML Even more importantly. If the client wants anything changed. Figure 2 shows the same record displayed in Internet Explorer through Instant Web Publishing in the front window and in the actual FileMaker OTHER WEB SOLUTIONS XML is not the only way to combine FileMaker Pro databases with web sites.This shows users a dynamic view of the data as it exists at the moment they load the page. Searches and sorts can be performed against the local XML view of the data rather than requiring a round trip to the server. on either the client or server side.They can’t choose to sort by price. or other middleware products to connect their web pages to a backend FileMaker Pro database require the server to do a lot of work reading HTML files. for more precise formatting. For instance it wouldn't be adequate for Figure 2: A record in a FileMaker Pro database served via the FileMaker Web Companion Pro database in the back window. One of the biggest advantages of Instant Web Publishing is that it does an excellent job of simulating the look and feel of a FileMaker Pro layout. an e-commerce site that needed to let customers know whether a product was in stock right this minute. even if records are being added to or edited in the database at the same time they're browsing and searching it. it doesn't allow users to interact with the data. making those queries against the FileMaker Pro database. To change the way 6 . making sorting. then inserting the results back into the HTML before sending it to the client. INSTANT WEB PUBLISHING Another approach. including Unix and Linux systems that can't run FileMaker Pro. To more clearly see XML's advantages. Furthermore. Another possibility is to show the user only part of the data their query returned (say ten records out of a hundred).The fidelity of the HTML page to the original FileMaker Pro layout is amazing. is to publish the database itself on the Web using Instant Web Publishing. let's first look at some of the other approaches that have been taken over the last few years and the problems they've had.) This approach also allows you to serve data from any computer with a web server. From their web browsers. but it doesn't work so well if the data changes on a frequent basis.As long as the data can be stored and manipulated on the client. you tend to lose a lot of the data's structure when moving to pure HTML. with calculation fields and a little AppleScript or Perl. or style sheets. such as searching for all the books by a particular author. And all of this can be accomplished without having to write any programs. However. But the biggest problem with this approach is that the web site is not automatically updated when the database changes. You can use layout themes to modify color schemes but you can't rearrange items on the page. As already noted. Users can rest assured that any page they see has the most current and up-to-date data. finding the database queries embedded in the files. or add items to or remove items from a shopping cart. no matter how small. Sometimes that's OK if you just want to present a static picture of the data to the user. Instant Web Publishing offers limited customization.This approach is only suitable for very static. For smaller data sets it can even be more efficient to move all the data to the client as XML. Web sites that use CDML.The browser does all the tricky formatting and manipulation of the data. it has to go back to the server which has to repeat the entire process. XML works better because all the server has to do is send some simple query results to the client. scripts. searching. the number of queries and consequently the load on the server are reduced. and editing records in the database very easy. EXPORT AS HTML The first and most obvious approach is to simply export the data to HTML. This can be done by exporting a database as an HTML table or. users can even see and interact with the same layouts they'd use if they were connected with a FileMaker Pro client. first introduced in FileMaker Pro 4. XML is much faster than proprietary solutions. but it is one of the best. then use Java or JavaScript to perform all the manipulations on the client side.This is an extremely wasteful use of finite server resources.

even a very fast one. vendors. However both ODBC and JDBC process data on the server side. With XML you can use JavaScript or VBScript to build robust. It doesn't have to spend a lot of CPU power or processing time massaging the data into HTML that's suitable for client display. but it's not suitable for dynamic sites that let the user rearrange the data to meet their needs. Additionally CDML (and other middleware technologies) are proprietary. making the queries. to do all the work itself. with ODBC or JDBC. FileMaker Pro does less work on the back end because XML is a lot closer to the data's native format. THE XML ADVANTAGE XML has a number of advantages compared to all these approaches. The Java code includes standard SQL queries that the FileMaker JDBC driver forwards to the FileMaker Web Companion. OTHER WEB APIS Another possibility is to use database middleware like ODBC or JDBC to connect to the FileMaker Pro database and load data into the HTML pages.01 can build pages in this fashion by using the FileMaker ODBC driver. 2. Formatting a single HTML document isn’t a significant resource issue. the client still only gets unstructured HTML with all of its attendant disadvantages. and Oracle.You can always buy bigger and faster hardware. proprietary tag sets prevent you from easily migrating your data and web site to Oracle or IBM's DB2. The Web Companion returns the results. but it's a lot cheaper to move to an XML-based.This allows you to use a sort of server-side include to integrate your HTML pages with data from a FileMaker Pro database.The server receives a query and sends a response that's very close to the raw data. New applications should move to XML so they can take advantage of future developments. most database experts aren't accomplished graphic designers and more graphic designers are comfortable working with HTML than with FileMaker Pro.. and programming language agnostic. It also makes it much easier to exchange data with other individuals. Parsing an HTML file to find out what queries to make. XML can be a lot faster because it removes the need to parse the HTML just to find the queries. and then building a new document by combining the old document with the results of those queries puts a lot of load on a database.This broad support makes it much easier to learn and use XML. is moving towards more open standards. Secondly. Formatting thousands of them is. This may be sufficient if you want to hide your data's structure or you only want to present a static picture of the data to browsers. and with their databases since you're all using the same technology.You write an HTML file in which you include special tags like [FMP-FIELD: title] and [FMP-if] that tell the server what query to make against the database. well-understood technology with lots of third party support in the form of software. When a browser requests a document. And while FileMaker Pro's layout tools give you the ability to create beautiful user interfaces. The biggest problem here is speed. XML is well-documented. FileMaker Inc. IBM. Furthermore. and the servlet or JSP wraps them in HTML before passing them on to the client. Furthermore. client-side approach. you're pretty much stuck with whatever features the vendor has provided tags for. Furthermore. With strong XML. than for one server. the server replaces the CDML tags with data from the database. 1. Other non-Java Web development tools like Allaire's Cold Fusion and Adobe's GoLive 4. custom applications and behaviors. JDBC is especially convenient if your web server supports servlets or Java Server Pages (JSP). contractors. Since these aren't extensible.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML your web site behaves after a record has been added or deleted. JDBC. database. It's a lot quicker for FileMaker to send the data out in pure XML and let the client convert that to HTML than to do all the work on the server side. and ODBC support across the FileMaker 5 family. time-consuming formatting that could be done more cheaply and quickly on the client. books. XML is non-proprietary and supported by more database vendors every day like FileMaker. the more problematic this becomes. The server then sends the browser pure HTML that it can display without any special software.The more successful your web site is and the more hits it gets. It's faster for each of thousands of clients to do its own small piece of the work in parallel. XML is platform. CUSTOM WEB PUBLISHING WITH PROPRIETARY TAGS Still a third approach is to add CDML tags to your HTML files. companies. either on the database server or the web server which has to do a lot of expensive. It's just as happy to work with FileMaker Pro and WebStar on a Macintosh as Oracle and Apache on Solaris. you need to use additional technology like XML. Inc. customers. Most importantly XML is faster because it moves a lot of the work to the client. XML is a standard. 7 . specifications and more.

or an application server to talk to the database. probably by filling out and submitting a</A> </body></html> Figure 4: A Web Page generated by FileMaker Pro in response to CDML markup Figure 3: Querying FileMaker Pro for XML Again. Once it has retrieved this style sheet. A client system. generally a browser. the identification becomes even clearer. This form or link is set up to pass both a query to the server and details about how the information is to be encoded in XML. If the XML is intended to be displayed to a person. servlets. the FileMaker Web Companion web server retrieves the requested data from the database server and replaces the proprietary markup with the data. the basic approach of these solutions is the</title></head> HOW DOES FILEMAKER PRO SUPPORT XML? FileMaker Pro serves XML via the FileMaker Web Companion.Adding CDML to pages is one approach historically used by FileMaker Pro backed sites. and in some ways it is. Another important benefit of XML in today's increasingly heterogeneous Internet is that XML documents are at least partially self-documenting.The result is a page of pure HTML. and shows it to the user.The proprietary tags are in bold. For">webmaster@funnynovels. level syntax differs. Figure 3 summarizes this process: <body> <h1>Funny Novels in stock on [FMP-CurrentDate]</h1> <UL> [FMP-Record] <LI>[FMP-Field: title]. FileMaker Web Companion then sends this HTML page to the client. <html> <head><title>Available Titles at FunnyNovels. then passes that XML back to the client. the server will include information with the document telling where a style sheet for the document can be found. <i>[FMP-Field: author]</i> [/FMP-Record] </UL> <HR> Copyright 1999 Funny Novels<BR> <A HREF="mailto:webmaster@funnynovels.That isn't true of less flexible formats like HTML or tab delimited text. Although the low FileMaker Web Companion must replace the bold tags with standard HTML before sending this file to a browser. The server formats the data as XML. makes a particular request to the web server. The page the user requests contains markup in the proprietary language telling the web server how to fill it out with data from the database. which displays it to the user. When you see an item l i ke < p e r s o n > < l a s t > E l i a s < / l a s t > < f i r s t > J a s o n </first></person>. But that's because the FileMaker Web Companion is doing a lot more of the work and the browser 8 . Thus. Figure 5 summarizes this process. Another is to use Java Server Pages. here's a page that uses CDML markup to provide a current list of titles in stock. you can easily tell that Elias is the last name of a person and that Jason is the first name. This looks simpler than the XML process in Figure 3. generally a browser. Figure 4 shows the resulting HTML page displayed in Netscape Navigator. it formats the XML according to the instructions in the style sheet. makes a request to the server using an HTML link or form. CGIs. there are many other approaches for a web browser to get data out of a database. With a DTD or schema and appropriate comments.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML 3. The browser then requests the style sheet.The client.

If they want to import the data into their own databases. However if FileMaker Pro is sharing a machine with another web server like Apache or WebStar.You'll also need to provide a CSS or XSL style sheet or use JavaScript to tell the browser how to display the XML data.The pure XML based solution more or less requires a fifth generation browser (for example. it's simply a matter of connecting to the server with a Web browser using a URL with the appropriate query string. However since.When talking to FileMaker Pro over the Web. any server-based solution currently has much broader browser support. enable the Web Companion checkbox. the machine running FileMaker Pro must be connected to the Internet using TCP/IP and the FileMaker Web Companion must be turned on. then you'll need to choose a different port. there's an extra step. which is good for presentation but not much else. (The Gartner Group estimates that by "year-end 2001. the host: funnynovels. To activate this. which limits your ability to deploy a solution like this. Once the Web Companion is enabled. the hypertext transfer protocol. If it wants to see a slightly different view of the data. Then. this will always be http. clients are closer to the real data. this is an inefficient use of a server's limited resources. REQUESTING XML DATA FROM FILEMAKER PRO Data can be retrieved in XML format from a FileMaker Pro 9 . typically using an XSLT style sheet and Microsoft’s Active Server Pages (ASP) or Sun’s Java Server Pages (JSP). XML doesn't carry any formatting information. open each database you want to share. If you're running another web server on the same system. 80% of all Web-based technology will use XML-defined data interchange. they This specifies the name or IP address of the server FileMaker Pro is running on. just formatted and organized a little differently. is transformed to HTML on the server on port 591. it makes sense to push as much of the work as possible onto the clients to relieve the burden on the However. pull down the Edit menu and open the Preferences/Application… dialog box. it has to go back to the server and ask for the exact same data. Of course as users upgrade their browsers. they can. On the other hand. It can send viewable data to pretty much any browser since Netscape 1.") In the meantime. go to the File Menu and select Sharing.fp5 database from a FileMaker Pro database running on the host funnynovels. by opening FileMaker Pro (and hence the FileMaker Web Companion) on the server and using CGI commands from the client to make queries.fp5&format=-fmp_xml&-max=all&-find Figure 5: Querying a server for HTML with CDML is doing a lot less. suppose you want to get an XML formatted list of the records in the novels. As long as there are many clients per server. unlike HTML. you'll need to pick some port other than 80. in the second approach a client only gets HTML. With XML. If they need to further process the data. In the resulting dialog box. Choose the Plug-In tab and check the Web companion check box. Click OK twice to get out of the dialog and save your changes. for instance by sorting or summing it. On mediumto-high volume web sites. By contrast. For example.This allows you to support all web browsers while sticking with standard markup languages and still achieve substantial speed-ups. To get data out of a FileMaker Pro database as XML. the port: 591 Normally HTTP servers run on port 80. the XML. a lot of sites have chosen to go with a hybrid solution in which the database generates XML. FileMaker has registered port 591 with the IANA for this purpose. Next select Web Companion and click the Configure button. this will become less of a concern. This doesn't just have to happen once.0. Internet Explorer 5 or the upcoming browser from Netscape). By using JavaScript the client can re-sort and organize the data multiple times according to a variety of criteria. rather than being sent directly to the client. This URL can be divided into five parts: the scheme: http This specifies which protocol is used to communicate with the server.Then you would type this URL into your Web browser's location bar or Open page dialog: http://funnynovels.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML database over the Web in much the same way it can be retrieved in HTML format.

FileMaker Pro supports over two dozen different variables in its query strings that allow web surfers to create new records. all). This form uses hidden INPUT elements so that the query string will be set up exactly. For example. and perform other operations in the database directly from their browsers. For"> Figure 6 shows Internet Explorer 5 connecting to this database using this URL. sort. the value "novels.fp5". and run scripts in databases. -format. which specifies the number of records to retrieve (in this case. -format. which specifies the database name (in this case.When using the FileMaker Web Companion as your server to serve XML. Since we haven't yet attached a style sheet to the document.fp5&-format=-fmp_xml&max=all&-find This provides input for the web server program that decides what data to send back. most of the time you won't be blindly typing query strings into the location bar.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML the file path: /FMPro This tells the server which file to serve. which specifies which FileMaker XML grammar to use (in this example. like this: <a href="http://funnynovels.fp5&-format=-fmp_xml&Author=Jerome&find=List+Books Figure 6: Internet Explorer 5 showing raw XML from a FileMaker Pro database served over the Web Of course. A complete list of the query string 10 . search databases.IE uses its default.fp5" TYPE="hidden"> <INPUT NAME="-format" VALUE="-fmp_xml" TYPE="hidden"> <INPUT NAME="-max" VALUE="all" TYPE="hidden"> <INPUT NAME="-find" VALUE="List Books" TYPE="submit"> </FORM> The query string variables that begin with a hyphen like -db.fp5" TYPE="hidden"> NAME="-format" VALUE="-fmp_xml" TYPE="hidden"> NAME="Author"><br> NAME="-find" VALUE="List Books" TYPE="submit"> The form is shown in Figure 7: Figure 7: A simple author search form The query string it builds up looks like this: -db=novels. sort databases. this HTML form would let users access the complete book list: <FORM METHOD="GET" ACTION="http://funnynovels. this is always /FMPro. <INPUT <INPUT <INPUT <INPUT </FORM> NAME="-db" VALUE="novels. are names of fields in the database. which is the request for data. one of the advantages of a FileMaker Pro backed web site is that users can search. edit existing records.The information is provided in name=value pairs separated by & signs.This query string has four variables:"> <INPUT NAME="-db" VALUE="novels. By using INPUT elements with different names you can search by different fields in the database.The query string variables that don’t begin with a hyphen. Instead you'll set up online forms so surfers can just press a button to access the database. and -find are all instructions to FileMaker Pro. All of these operations are performed by changing the values of query string variables or indirectly by setting up forms to use different query string variables. and -find. "-fmp_xml". Another approach is to make the complete query string part of the value of the href attribute of a Author in this example.tree structured XML presentation that allows you to collapse and expand headings. this form lets the user search by author: <FORM METHOD="GET" ACTION="http://funnynovels. On the other hand. fp5&-format=fmp_xml&-max=all&-find"> List Books </a> the query string: -db=novels. -max. In this case you'd give the user non-hidden INPUT elements that let them type in what they wanted to search for or sort by.

a database independent grammar The FMPXMLRESULT grammar can encode an arbitrary table in XML. However even with XSL—which can select based on attributes and element content—it's easier to select element names. The FMPDSORESULT grammar uses elements whose names match the names of the fields in the database.filemaker. This makes it difficult to use CSS to apply different styles to different fields. or at the FileMaker XML central web site: www. This means you can apply different CSS style rules to different fields. you do have to write a new style sheet for every different database you want to work with.0" encoding="UTF-8" ?> <FMPXMLRESULT xmlns="http://www.The benefit of using "generic" tags is that the same style sheet can be easily reused with other FileMaker Pro databases. <?xml version="1.The database schema is described by a METADATA element that contains one FIELD element giving the name and type of each field. prices. this is a lot easier for human beings to read than the next two formats we'll look at. the FMPXMLLAYOUT grammar is used to describe not the data in a table but rather the semantic organization of the table such as the values allowed in a value list.0v2" /> <DATABASE DATEFORMAT="M/d/yyyy" LAYOUT=""NAME="novels. a book title would be described with the same generic DATA tags that are used for author names. Of course. and so forth.fp5&-RecID=1&Cover=&Img</Cover> <Price>$6. Every database with a different schema will need a different DTD. XML itself says very little about what tags you may and may not use where in your documents.95</Price> </ROW> </FMPDSORESULT> One consequence of using field names as element names (rather than as element content or attribute values) is that the field names must be included in the DTD. if you work mostly with one database at a time. unlike FMPDSORESULT. and other fields.Which one you choose depends on whether you want to use the same XML vocabulary for all your databases or different. FileMaker Pro can serve data encoded in any of three different XML vocabularies. Jerome</Author> <Cover>FMPro?-DB=novels. then having the field names encoded as element names makes it a lot easier to apply style rules to particular elements.0" encoding="UTF-8" ?> <FMPDSORESULT xmlns="http://www.This is because. it uses a fixed set of elements.These are enough to describe any database. The FMPXMLRESULT grammar uses a vocabulary with elements that represent database records.These are: • The FMPDSORESULT grammar (database dependent) • The FMPXMLRESULT grammar (database independent) • The FMPXMLLAYOUT grammar FMPDSORESULT and FMPXMLRESULT are alternative XML vocabularies for describing the records and fields in a FileMaker Pro 5 database."> CHOOSING A FILEMAKER PRO XML GRAMMAR XML is a very general syntax for documents.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML variables you can use to request XML from a FileMaker Pro database."> <ERRORCODE>0</ERRORCODE> <PRODUCT BUILD="9/8/1999" NAME="FileMaker Pro Web Companion" VERSION="5. and so forth. result sets. a database dependent grammar The FMPDSORESULT grammar uses field names as element names. Computers. but they're a little generic. A small result set in the FMPDSORESULT grammar looks like this: <ERRORCODE>0</ERRORCODE> <DATABASE>novels. ISBN of course. more specific vocabularies for different databases. as well as the exact syntax for the values of these variables. For instance. XSL style sheets are more flexible and can better deal with a database table-independent grammar like this using other non-name cues like element position.fp5" RECORDS="4" TIMEFORMAT="h:mm:ss a" /> <METADATA> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Title"TYPE="TEXT" /> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ISBN" TYPE="TEXT" /> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Author" TYPE="TEXT" /> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Cover" TYPE="CONTAINER" /> <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Price" TYPE="NUMBER" /> 11 .filemaker. you can't write a very good generic style sheet for displaying this data. Finally.fp5</DATABASE> <LAYOUT></LAYOUT> <ROW MODID="2" RECORDID="1"> <Title>Three Men in a Boat: To Say Nothing of the Dog!</Title> <ISBN>0140012133</ISBN> <Author>Jerome K. Furthermore. Any style sheet that provides an attractive format for this data will have to know that ISBN numbers are included in ISBN elements. fields. FMPXMLRESULT. don't much care about that.The same result set encoded in FMPXMLRESULT looks like this: <?xml version="1. Similarly. can be found in Appendix B of the FileMaker Developer's Guide. Most applications of XML restrict themselves to a well-specified subset of XML.This is especially true in CSS because most current CSS implementations can't select based on attributes or element content.

Here's the FMPXMLLAYOUT description of the same database that the previous two result sets came from. Instead it relies on a style sheet or script to specify how each individual element is to be presented.The FMPXMLLAYOUT grammar. you need a much more attractive web page. radio buttons.Whereas both FMPDSORESULT and FMPXMLRESULT focus on the data in the database. predictable structure of an FMPXMLRESULT is easier to handle through JavaScript and the Document Object Model (DOM) than the looser FMPDSORESULT grammar.fp5&-RecID=1&Cover=&-Img</DATA> </COL> <COL> <DATA>$"> <ERRORCODE>0</ERRORCODE> <PRODUCT BUILD="9/8/1999" NAME="FileMaker Pro Web Companion" VERSION="5. then the list of possible values is included as well. the same default values.The Extensible Style 12 . the very regular.--it's easy to provide a DTD that can validate any FMPXMLRESULT document. FMPXMLLAYOUT is the third and final XML grammar that FileMaker Pro supports. since the actual data is all stored in DATA elements.0v2" /> <LAYOUT DATABASE="novels. describes the structure and layout of a record. and the same user interface components. pop-up lists. If you're able to use XSL or fifth generation browsers. For instance. but rather one particular layout from the database the previous result sets came from. COL. ROW. A GRAMMAR FOR LAYOUTS <?xml version="1. it's quite limited in what it can accomplish. What an FMPXMLLAYOUT document doesn’t tell you is any data that belongs to any particular record. either dynamic or included in the layout. There are several choices for formatting languages. In practice. what's described here is not a result set. etc. it's pretty much impossible to use CSS to attach different styles to different fields. the document itself includes a pretty decent schema for the database (not the same thing as an XML schema!) in the METADATA element. Cascading Style Sheets (CSS) is the most broadly supported style sheet language and one of the simplest. DATA. XSL's more powerful selection facilities do allow you to make statements like that. Jerome</DATA> </COL> <COL> <DATA>FMPro?-DB=novels. checkboxes. If the value of the field is taken from a value list. However. as opposed to the general structure of all records in the table. though.0" encoding="UTF-8" ?> <FMPXMLLAYOUT xmlns="http://www. XML says nothing about how the data is presented.fp5" NAME="allfields"> <FIELD NAME="Title"> <STYLE TYPE="EDITTEXT" VALUELIST="" /> </FIELD> <FIELD NAME="ISBN"> <STYLE TYPE="EDITTEXT" VALUELIST="" /> </FIELD> <FIELD NAME="Author"> <STYLE TYPE="EDITTEXT" VALUELIST="" /> </FIELD> <FIELD NAME="Cover"> <STYLE TYPE="EDITTEXT" VALUELIST="" /> </FIELD> <FIELD NAME="Price"> <STYLE TYPE="EDITTEXT" VALUELIST="" /> </FIELD> <FIELD NAME="Binding"> <STYLE TYPE="RADIOBUTTONS" VALUELIST="Bindings" /> </FIELD> <VALUELISTS> <VALUELIST NAME="Bindings"> <VALUE>hardcover</VALUE> <VALUE>softcover</VALUE> </VALUELIST> </VALUELISTS> </LAYOUT> </FMPXMLLAYOUT> The other grammars tell you what the data is and what the type of the data is. FORMATTING XML DOCUMENTS The almost source code like view of the XML in Figure 4 is not ideal. Furthermore. However.filemaker. For example it provides field names. RESULTSET.You can use all this information to build HTML forms that use the same value lists. However. However.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML </METADATA> <RESULTSET FOUND="1"> <ROW MODID="3" RECORDID="1"> <COL> <DATA>Three Men in a Boat: To Say Nothing of the Dog!</DATA> </COL> <COL> <DATA>0140012133</DATA> </COL> <COL> <DATA>Jerome K. or pop-menus and so forth). Furthermore. FMPXMLLAYOUT describes the layout of the fields. FMPXMLLAYOUT. you can't say that the title is bold but the author is plain text. you should probably choose FMPXMLRESULT in preference to FMPDSORESULT. by contrast. the types of the fields (whether they're formatted as editable text boxes. It's a little different than the other two because it provides different information than the other two.95</DATA> </COL> </ROW> </RESULTSET> </FMPXMLRESULT> Since all FMPXMLRESULT documents use the same fixed set of tags and attributes--DATABASE.

For example. Unlike HTML it makes no assumptions about how data is to be arranged on the page. All of these options share the advantage that the actual formatting information can be stored in a separate file from the data itself. Cover {display: none} Figure 8: A find request with a CSS style sheet applied Elements generally inherit properties from their parents. ISBN. they are limited to applying styles to what text is present in the document. such as table structures and text that doesn't flow from left to right and top to bottom (like Arabic or traditional Chinese). XML has no such underlying formatting model. big and bold */ Title {font-weight: bold. and Price on separate lines */ Author {display: block. Figure 9 shows the books database served in XML and formatted with this CSS1 style sheet (comments are enclosed in "/*" and "*/"): /* These are the defaults for the entire page */ FMPDSORESULT {display: block. However. It relies on features of HTML to accomplish tasks like this. However. most widely supported style sheet language for XML is Cascading Style Sheets Level 1 (CSS1).TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML Language (XSL) is more powerful but more complex. CSS2 isn't very well supported by common browsers yet. Finally. font-size: large} 13 . For instance. albeit one that comes with a price in increased complexity. DATABASE. CSS Level 1 alone is too simple to handle many common needs. However. sans-serif. Unfortunately. It's a lot more attractive than Figure 5. We’ll demonstrate using XSL. Arial.Another extremely powerful option. LAYOUT. It does. since CSS1 and CSS2 are static markup languages. allowing designers and programmers to use familiar tools like BBEdit or HomeSite to write their style sheets and scripts. or merge text with boilerplate information. Figure 8 shows what the result looks like after the above style sheet has been applied. To do this with CSS. in the above style sheet the Author and Price are in a serif font (preferably New York) but Title is in a sans serif font inherited from their parent FMPDSORESULT element because it has a more specific rule setting its font face. but can override them if they choose.This is a very straight-forward language that simply lists properties for particular elements. have substantial third party support. below. CSS Level 2 does add a lot of features that are necessary for the more complex task of styling XML. It can say that the Title element should be bold. it doesn't allow you to organize information as tables instead of paragraphs or embed images in a document. you must use CSS properties via the DOM from scripting languages like JavaScript. They can't reorder that text. Times New Roman. serif} /* These are the elements we want to hide from the user */ ERRORCODE. and does not yet have broad browser support. Connecting a style sheet or script to the actual data returned from the database is easy.With just a little forethought when first designing the style sheets or scripts. /* Make the title look like an H1 header. however. font-family: New York. font-family: Helvetica. is using the Document Object Model and a scripting language like JavaScript or VBScript to format and manipulate the native XML data and/or reformat it into HTML. FORMATTING XML USING CSS The simplest. even if the style sheet is delivered from a different web server. many different queries can all use the same few standard style sheets or scripts. font-style: italic} ISBN. Table 1 summarizes the various options and their advantages and disadvantages: /* Put author. saying that the first COL element in a RESULTSET should be bold exceeds CSS's limited selection capabilities (although CSS2 may do this). Price {display: block} Here we're using the FMDSORESULT grammar because CSS is quite limited in what it can apply styles to.

For example. this means that XSLT can do anything CSS can do. XSL is much better suited to the specific needs of XML.funnynovels. and indeed XSLT is much further along in both specification and shipping software than XSL-FO. The most common way to use XSL with FileMaker Pro is to write an XSLT style sheet that transforms the XML FileMaker Pro emits into HTML that the browser knows how to display.funnynovels. You just need to add -styletype and -stylehref variables to the query string that specify the MIME type and URL respectively of the style sheet you want to use. The –styletype tag specifies the type of stylesheet to use and the –stylehref tag specifies the file location).funnynovels. The transformations half defines an XML vocabulary for describing how one XML document is transformed into another XML document. FORMATTING XML USING XSL XSL is a much more complete style sheet language than CSS.All you have to do is add these two hidden fields to the form that makes the query: <INPUT NAME="-styletype" VALUE="text/css" TYPE="hidden"> <INPUTNAME="-stylehref" VALUE="http://www. An XSLT style sheet for the books example using the FMPDSORESULT grammar would look something like this: This transforms the XML FileMaker Pro sends into very nicely formatted HTML as Figure 9 shows. which is really designed for HTML with XML support tacked on as an afterthought. it's straight-forward to mix the actual data from the database with boilerplate text like this. Furthermore. Since the style sheet can contain literal result elements like "<TITLE>" and text strings like "Copyright 1999 Funny Novels" as well as XSL instructions like xsl:template. com/styles/books. and contents of boxes on pages. styles. It's almost PostScript like in its power and flexibility.w3. Since HTML can use CSS formatting properties. before serving the document.css" TYPE="hidden"> <?xml version=" styles/books. Figure 9: A find request with an XSL style sheet applied This style sheet matches one template to the root element FMPDSORESULT that wraps the entire page in a standard 14 .css. XSL is divided into two parts: XSL Transformations (XSLT) and XSL Formatting </A> </BODY> </HTML> </xsl:template> <xsl:template match="fm:ROW"> <h2> <xsl:value-of select="fm:Title"/> by <i><xsl:value-of select="fm:Author"/></i> </h2> <ul> <li>ISBN: <xsl:value-of select="fm:ISBN"/></li> <li>Price: <xsl:value-of select="fm:Price"/></li> </ul> </xsl:template> </xsl:stylesheet> This will add these two variables to the query string: -styletype=text/css&-stylehref=http://www. FileMaker Pro will insert the necessary <?xml-stylesheet?> processing instruction to connect the document it sends to the style sheet you've" xmlns:fm="http://www.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML Connecting a style sheet to the actual data returned from the database is easy. (XSL-FO). as opposed to CSS.0"?> <xsl:stylesheet xmlns:xsl="http://www. The only difference is that the -styletype query string variable would have the value "text/xsl" instead of "text/css". These two parts are useful independently of each other. The formatting objects half defines an XML vocabulary for describing the layout. and then quite a bit XSL style sheets are attached in much the same way. while XSL is much more powerful than CSS. it's also quite a bit more complex. However. suppose your style sheet is at the absolute URL"> <xsl:template match="fm:FMPDSORESULT"> <HTML> <HEAD><TITLE>Books in Inventory</TITLE></HEAD> <BODY> <H1>Funny Novels Inventory</H1> <xsl:apply-templates select="fm:ROW"/> <HR></HR> Copyright 1999 Funny Novels<BR /> <A HREF=""> webmaster@funnynovels.Then.

org/1999/XSL/Transform" xmlns:fm="http://www. The child elements of the document become properties of the object. Inside the template for the root element. tree-structured XML view. Naturally. format elements with the same name but different content differently. Anything you can do in HTML. This is an ActiveX control that connects to the MSXML parser. and more. The ROW template pulls each piece of data—the author. Scripting is programming.This demonstrates the power of XML: Microsoft never considered the needs of FileMaker Pro when it wrote Internet Explorer. (Netscape has a different DOM which supports none <xsl:template match="fm:FMPXMLRESULT"> <HTML> <HEAD><TITLE>Books in Inventory</TITLE></HEAD> <BODY> <H1>Funny Novels Inventory</H1> <xsl:apply-templates select="fm:RESULTSET"/> <HR></HR> Copyright 1999 Funny Novels<BR /> <A HREF="mailto:webmaster@funnynovels.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML HTML envelope like a HEAD element and a signature block with a copyright notice. yet because FileMaker Pro supports XML. Scripting can accomplish anything XSLT can. The trade off of using a scripting language to access the document is that it's considerably more complex than the alternatives of CSS and XSLT.filemaker. However. XSLT also works for the FMPXMLRESULT grammar. it can sort and reorder elements. as well as performing a lot of things XSLT can't— like making network connections to load document parts that are only referenced by URL in the input document or dynamically updating the view of the data based on what the user does with the mouse. select elements based on attribute values. 15 . For every ROW child. Beyond the simple style sheets we've seen here. For instance. then you need to use a scripting language like VBScript or"> </A> </BODY> </HTML> </xsl:template> <xsl:template match="fm:ROW"> <h2> <xsl:value-of select="fm:COL[position()=1]"/> by <i><xsl:value-of select="fm:COL[position()=3]"/></i> </h2> <ul> <li>ISBN: <xsl:value-of select="fm:COL[position()=2]"/></li> <li>Price: <xsl:value-of select="fm:COL[position()=5]"/></li> </ul> </xsl:template> </xsl:stylesheet> Since XSLT can produce essentially arbitrary HTML output. If you really need to manipulate XML on the client side in a truly arbitrary fashion. and while programming in JavaScript may be easier than programming in traditional languages like C or Java. and can accomplish a lot.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3. VBSCRIPT) XSLT is extremely powerful. (possibly including some CSS as well) you're only limited by the capabilities of HTML. In this case you can't select individual fields like Author using the element names since all the element names are the same. we can easily make FileMaker Pro records and result sets into objects that Internet Explorer natively handles. It then exposes the XML document to the script as an object. The first step in using JavaScript to format XML data is to get the XML into the HTML document that holds the script. SCRIPTING AND THE DOCUMENT OBJECT MODEL (JAVASCRIPT. in Internet Explorer 5's default. you can do in XML + XSLT transformed to HTML. And. By reading the values of the properties of the object (and the values of the properties of the properties and so forth) you can access any node in the XML document. while less than ten percent of your program is devoted to the dynamic features that really demand scripting. ultimately XSL is a declarative language that focuses on the structure of the input document. here we'll focus on a method supported in Internet Explorer 4 for Windows and later. Instead you have to choose fields by their positions relative to their siblings in their parent ROW element. The MSXML parser exposes the contents of the XML document using Internet Explorer's Document Object Model. it fills in and outputs the template for the ROW element. perform simple arithmetic. <?xml version="1. etc—and puts it together along with some standard HTML formatting tags like <H2> and <i>.signs in the left hand column. or DOM. depending on your task. Internet Explorer 5 provides several approaches including XML data islands and an XMLDSO applet. the title. scripting is responsible for showing and hiding the individual parts of the document as the user clicks on the + and . The same can't be said for XML + CSS which is missing some of the power of HTML. xsl:apply-templates processes each ROW child element.This ActiveX control can load an XML document from a URL on the network. it still requires a reasonable facility with programming"> webmaster@funnynovels. you may find that 90% of your code does something that could be more easily and cleanly done in XSLT. we'll set the ActiveX control to a URL that points into a FileMaker Pro database.

text. // Each row in this database represents a book for (row=0. Here's the loadbooks.children.item(1). in the FMPXMLRESULT grammar be exactly one of these: docroot. var author ="> webmaster@funnynovels.item(4). but it's simpler just to take the This script is extremely short on error checking and makes a lot of assumptions that particular fields like Title and Author will be in particular places in the document. and ISBN are stored in // convenient variables. var title = columns.text. price.write("<li>ISBN: " + isbn). The XSLT style sheet shared this issue. Ideally. We could get the DATA children // here as well. } The resulting web page.children. Probably more than 90% of the time both JavaScript and XSLT are completely capable of doing anything you need and your choice between them is mostly a matter of personal preference and software support.children. and price are always // in the same columns. we simply wrap them in a little // literal HTML and write the data into the web page. author.item(row). row++) { // The fields are in COL elements which are the // only children of the ROW elements.js script. The W3C is making efforts to standardize DOMs between browsers. // Get the root element of the document var docroot = xml. This returns an XML Document object whose child elements you can inspect. ISBN.item(2). document. // Look for the // We know that // there should var resultset = RESULTSET child of the root.text. download the XML.URL = "http://localhost/fmpro?-db=novels. // Now that the title. var columns = rows.) The IE DOM allows you to access the XML document at a remote URL by invoking the MSXML XML parser as an ActiveX Control.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML of this to date. It loads an external script file called loadbooks. However. document.fp5&format=-fmp_xml&-find".The 16 . However. document. // Tell the parser which document will be parsed xml. var price = columns. they might change if someone deleted a field from the database. of which Internet Explorer 5 has partial support.write("<h2>" + title + " by <i>" + author + "</i></h2> "). in that case the solution would be a lot more complex to implement than here. shown in Figure 10.length. In these cases you really need a scripting </A> </BODY> </HTML> // complete text of each column since our database doesn't // have any repeating fields. row < rows. These positions shouldn't change capriciously from run to run. It has released an official specification for DOM Level 1. // The title. is almost identical to the page produced earlier by XSLT. Below you see an HTML page designed to handle this. <HTML> <HEAD><TITLE>Books in Inventory</TITLE></HEAD> <BODY> <H1>Funny Novels Inventory</H1> <SCRIPT LANGUAGE="JavaScript" SRC="loadbooks. author.write("<li>Price: " + price). var isbn = columns.js that will connect to the database. you'd want to compare the expected positions for fields with the position of the corresponding FIELD child of the METADATA element. However.The exceptions would be cases where you wanted to respond to the user dynamically in real time or you needed to merge data from multiple XML documents.item("RESULTSET").write("</ul>"). true cross-browser scripting and DOM support is still some time in the future. // Load the parser var xml = new ActiveXObject("msxml").item(0).text. document. and format it as HTML for insertion in the page. Figure 10: A find request that uses JavaScript formatting // We know that in the FMPXMLRESULT grammar // RESULTSET has zero or more ROW children // and no children of any other type var rows = resultset.root.write("<ul>"). or changed which fields appear on the layout. document.js"> </SCRIPT> <HR></HR> Copyright 1999 Funny Novels<BR /> <A HREF="mailto:webmaster@funnynovels.

provided it has some way to translate a remote XML document into an object to be accessed by the script.write("</ul>") Next </SCRIPT> <HR></HR> Copyright 2000 Funny Novels<BR /> <A HREF="mailto:webmaster@funnynovels. then save 17 .text author = columns.write("<li>Price: " + price) document. However. The same technique works with virtually any embedded scripting language. The reason is that both JavaScript and VBScript are accessing the same objects using the same object model.text REM Wrap the data in HTMl and write it into the document document.item(4). Not all of these can work with data loaded directly from a FileMaker Pro query over the Web.There are at least half a dozen other ways to do it that would produce identical results.write("<ul>") document. the document object is the same thing in VBScript as it is in JavaScript. If you prefer to design your documents visually rather than by typing style rules in a text editor—and most people do—then there are a number of free and cheap tools to help you do so by editing style sheets. this script is really quite similar to the JavaScript version and produces the same end result. or you could load the XML when the document first loaded and insert it into an element rather than simply writing it into the middle of the document. Since JavaScript is a full programming language.Various text editors like HotMetal. well-formedness is enough xmldoc. because this script was written using Microsofts Document Object Model.item(0).You may need to load an example page into your browser first. emacs. This is far from the only way to format a page using JavaScript. Once you've loaded the XML document into memory from the FileMaker Web Companion and possibly converted it to some convenient format.text isbn = columns.getElementsByTagName("DATA") REM Get each field from its known position title = columns.item(2). For example. TOOLS TO HELP FORMAT XML DOCUMENTS The basic tool for editing CSS is a text editor like UltraEdit. or BBEdit and a CSS compliant web browser like Mozilla 5 or Internet Explorer 5. it lends itself to multiple solutions. it's a simple matter of programming to sort it. FrontPage.XMLDOM") REM wait for the document to finish loading before continuing xmldoc. but for the most part any software you can edit HTML+CSS in will do the trick for XML+CSS as well. a representation of the HTML page.length -1) REM Put the fields of the record into the columns variable Set columns = rows. if you add support in this script for W3C DOM. For instance. it only runs on Internet Explorer.text price = columns. collapse"> webmaster@funnynovels. For instance.getElementsByTagName("ROW") REM Format each record For i=0 To (rows. The real advantage to JavaScript is dynamically manipulating the XML in response to user action.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML CSS style sheet did not share this problem because it used the FMPDSORESULT grammar that identifies the different fields by their names rather than by their positions. here's a version of the same script that uses VBScript instead of JavaScript. and BBEdit provide varying levels of support for CSS. An alternative solution would be to simply use that grammar instead of FMPXMLRESULT.item(i).validateOnParse = false REM Load the XMl data from the database. Since VBScripts can't be included in external files. HomeSite. Notice we use the REM FMPXMLRESULT grammar xmldoc. it's embedded directly in the HTML source: <HTML> <HEAD><TITLE>Books in Inventory</TITLE></HEAD> <BODY> <H1>Funny Novels Inventory</H1> <SCRIPT LANGUAGE="VBScript"> Dim rows. Of course all these examples really only reproduce what we already accomplished more simply with XSLT. you could use an XML element as a data island tied to DIV </A> </BODY> </HTML> Aside from the syntactic differences between Visual Basic and JavaScript.load("http://localhost/fmpro?-db=novels. rearrange it or reformat it on the fly.write("<li>ISBN: " + isbn) document.write("<h2>" + title + " by <i>" + author + "</i></h2> ") document. the script would work across platforms on W3C-DOM compliant browsers.fp5&format=-fmp_xml&-find") REM Here we go straight to the ROW elements.async = false REM validation isn't required.item(1). columns Dim xmldoc Set xmldoc = CreateObject("Microsoft. there's one row per record Set rows = xmlDoc. Some lines look almost identical.

Table 2 below summarizes the level of support for different combinations of XML and style sheets and scripting languages in the common browsers: Table 2: Browser support for style sheet and scripting languages 18 . However. and CSS. if you're relying on transforming XML to HTML on the server side rather than letting the browser do it for you. See http://www.html The Apache XML Project's Xalan: http://xml.x generation or earlier browsers that only support HTML.x and There are numerous others.iclway. there are a couple of packages worth checking out. Mozilla 5. XSL.0 or later. Then you can work on this local file instead.alphaworks. XSLT style sheets are trickier. C++. you're probably better off with a command line processor like xt or Xalan since they're more up to date with the final W3C XSLT Recommendation. once you've done that. Most of the time. Netscape 5. including ones written in Object Design's eXcelon Stylus is an XML Integrated Development Environment (IDE) for Windows 95/98/NT that can be used to develop XSLT style sheets compliant with the W3C's specification or with Microsoft's version of XSL supported in Internet Explorer 5.jclark. Netscape.5 and earlier and Netscape Navigator 4. you can deploy XML on the client side with reasonable confidence that users will be able to handle what you send It lets you trace the path the templates follow through a document. Python. However. However. There are fewer tools for editing XSL style sheets than CSS style and later. These browsers have limited ability to handle particular XML documents in special circumstances.apache. However. Attaching the finished style sheet to future queries simply requires moving it into the FileMaker Pro Web folder and adding -stylehref and -styletype variables to your query strings that point to your style sheet.You'll still need a text editor like emacs or BBEdit and a web browser to view the finished product.html Michael Kay's Saxon: http://users. However these three appear to be frequently updated. This requires that the client application know both XML and the specific style sheet language (and indeed the particular version of the specific style sheet language) you're sending it.7 and earlier only support HTML. Internet Explorer 4 for Windows can do a passable job of handling XML via JavaScript and the DOM. select and match expressions by automatically generating the necessary XPath syntax from example input and output documents. IBM's alphaWorks' XSL Editor is a pure Java program for editing and debugging XSLT style sheets. There are two basic ways to serve XML data to clients. well over half of web surfers today are still using 4. XSLT is more convenient for server side transformations to HTML because of the much broader availability of tools to handle this. Unfortunately. The second approach is to have the server apply the style sheet to the XML data to convert into lowest-common-denominator HTML that all browsers understand. it's quite easy to create the style sheet. XSLT processors that are open source and written in Java include: James Clark's xt: http://www.x and later provide varying levels of support for XML.odi. In particular. See http://www. and helps you write. an important characteristic on the bleeding edge that is XSL.To a large and Internet Explorer 5. The first is to send the raw XML along with a style sheet that tells the browser how to render the document.htm DEPLOYING A FILEMAKER PRO XML SOLUTION On an intranet where you know that your users surf with Internet Explorer 5. for most practical purposes both Internet Explorer 4. that's because XSL's formatting model doesn't easily lend itself to making text selections and pulling down a font or a style from a menu. and many other languages. CSS is more reliable when you want to send the XML documents themselves to fifth generation browsers because Mozilla.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML it to a local file from the browser. and they aren't nearly as visual. and Internet Explorer all support CSS to some degree.

included with FileMaker Developer 5. Internet Explorer's CSS support is incomplete and Mozilla/Navigator's XSL support is non-existent. much like the JavaScript and VBScript examples we saw earlier.The World Wide Web Consortium (W3C) has taken the lead in standardizing XML and many related technologies like XSL and Other sites of interest include: xml.The second approach is to embed a reference to the XML data in HTML files (or an XSL style sheet).w3. as well as the exact syntax for the values of these http://www.jclark. There are two basic approaches to server side conversion of XML and James Clark's XSLServlet (http://www.or PHP.The first approach is to put pure XML files on the web server (or in this case. FURTHER READING For more detailed information and examples of how to serve a FileMaker Pro database as XML. Particularly useful here is Tim Bray's Annotated XML Specification that explains both what the somewhat turgid XML specification really means and why it means it.w3. This is most commonly accomplished with Java servlets or ASP.You'll find the official specifications for these on their web site at htt:p://www. Some of the most important include: XML 1.w3. In an Intranet situation with homogeneous clients. The key element in this process is the servlet that knows how to transform the XML FileMaker Pro sends into the HTML the browser reads.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML One thing this table indicates is that if your client environment is at all http://www.0 Nameplaces in XML XSL Transformations XPath Document Object Model (DOM) Level 1 Cascading Style Sheets Level 2 (one of the most readable specifications) http://www.w3. Figure 11: Java Server pages used to perform server side transformations of XML 19 .You'll find the necessary files in the FileMaker Pro/Web folder/XML Example folder on your CD. then the only really plausible solution is to convert to HTML on the server side. This CD also includes a complete XML example that shows an inventory database designed to be run in conjunction with Internet Explorer 5 for Windows. consult the FileMaker Pro Developer's Guide. FMPXMLRESULT.This servlet can either operate directly on the XML using a parser.w3. along with some instructions to the server about how to replace the data and instructions with HTML before serving it to the http://www.w3. An appendix to the Developer's Guide contains a complete list of the query string variables you can use to request XML from a FileMaker Pro database. For more information about working with the FileMaker Web Companion.This example is also described in the FileMaker Developer's you may have a few more http://www. Figure 11 shows this process using Java Server Pages.w3.There are many good. There are many web sites on the Internet dedicated to XML. Even among fifth generation browsers. or it can be a more generic servlet that applies an XSLT style sheet to FileMaker Pro's XML. http://www.They don't have to learn a new style sheet language just to place a few tables on a page. serve them out of a FileMaker Pro database) and have the web server convert those XML documents to HTML before delivering them to browsers.The advantage of this approach is that designers can write all the presentational aspects of the page in normal.html). refer to the FileMaker Pro 5 User's Ongoing news coverage of developments in FileMaker Pro 5 and FileMaker Developer 5. For a detailed specification of the FMPDSORESULT.This is commonly accomplished with free servlets available to do exactly that including IBM alphaWorks' XML Enabler (http://www. familiar HTML. you should read the document type definitions for these vocabularies included on the FileMaker Developer 5 CD. and FMPXMLLAYOUT grammars. included with FileMaker Pro 5 Unlimited.

Field names. applications. For example. and cons of this and other formatting methods. Structured data has the potential to be manipulated and used much more precisely than unstructured data. meta data Data that describes data. CSS The simplest and least powerful way to apply style formatting to XML data. XML data is structured data. or posted about XML. parser An application (or part of an application) that interprets an XML document so that it can be manipulated or used.This massive site includes summaries of and links to W3C XML Working Groups. The XML-L mailing list is a user oriented list for people trying to use existing tools to work with XML Daily news updates about XML software.unc. DOM -Document Object Model A DOM is the way a browser makes elements in XML documents available to scripting and programming languages. a FileMaker Pro file) is structured data. and specifications as well as links to XML mailing lists. press releases. Inc. 20 . software.html Robin Cover maintains a huge database of almost every thing anyone or anybody has ever said. Currently. XML applications..hea. would be specified in a DTD.hea. but the the World Wide Web Consortium is developing a standard that will make it possible to write programs and scripts that work with any browser on any platform. and more. XML-L. The schema is the basis for rules that can be described in a DTD (see). http://www. and more. the Organization for the Advancement of Structured Information Standards. Be warned. that this doesn't always clearly distinguish between Microsoft and Internet Explorer specific extensions and standard XML. send email to OASIS.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML Microsoft XML Developer Center. xml-l@listserv. international consortium dedicated to standards articles and books about XML. for example for the creation of dynamic web pages.e. http://metalab. You can now choose to use XML or other API’s such as JDBC or ODBC instead.lists. FAQ lists. specifications. each browser has its own version of a “DOM”. for example for display in a browser. mailing lists newsgroups.ic. http://msdn. as determined by the database files and fields.document type definition A document containing rules to which all documents and programs involved in a particular project or application of XML must adhere in order to ensure compatibility and consistency. xml-dev. An XML document must declare any DTD that it must be validated GLOSSARY CDML FileMaker. In XML data from FileMaker Pro. formatting can be applied to data based on its category. The xml-dev mailing list is for high-level discussion among people writing software and specifications for XML processing. pros. See the Technology Preview’s section on Formatting XML documents for the uses. XMLInfo. Validation is done by a validating parser (see).oasis-open. structured data Data that knows what it is and how it is related to other elements around it. specifications. conferences. for example. is a nonprofit. FileMaker Pro optionally generates a DTD describing the rules governing each of the three grammars it can publish. It's intensely technical. http://www. proprietary tags for publishing FileMaker Pro data to the Web using custom web publishing. particularly through XML Data Islands and the DOM.domain" in the body of the message.To subscribe. Data stored in a table (i. Membership in OASIS is open to interested individuals for a reasonable price.To with the words "subscribe xml-dev you@host. Cafe con Leche.xmlinfo. The SGML/XML Web Page. however. written. articles. and James Tauber's XMLInfo is a well organized collection of links to XML resources including schemas. product-independent formats for structured information including XML. for example to display data in a browser. other web sites about with the words "SUBSCRIBE XML-L your name here" in the message schema The structure of a database.asp This site on the Microsoft Developer Network provides detailed information about how XML can be used in Internet Explorer 4 and 5. a field name. each piece of data is identified by its field name and is a subset of the data in a particular record. for example. http://www. schemas. send email to listserv@listserv. examples. style sheets. OASIS. DTD.

can be used to transform the XML from FileMaker Pro into HTML for display in a browser. examples. XSLT.. Use an XSLT style sheet.† FileMaker Server 5 Increase network performance and centralize administration of FileMaker Pro files with up to 250 guests. for example." 21 . ©2000 FileMaker.filemaker. an XML document can specify a style sheet in order to display its data in a browser. those other FileMaker Products must be version 5 or later. pros. both on the Internet and off. Style sheets can be written using CSS or XSL. Some persons and companies listed in the examples are purely fictitious. and the file folder logo is a trademark of FileMaker. For more information on the FileMaker product family. He is the author of numerous books. or to order software. valid An XML document is valid according to the rules specified in a DTD (see) if it follows those rules. visit www. All rights which provides additional technical papers. 5201 Patrick Henry Drive Santa Clara. and other countries. documentation. For more information visit the FileMaker XML web site at: http://www. or the runtime application (included). Inc. most recently:The XML Bible from IDG and Java I/O from O' has become one of the most popular independent Java sites on the Internet. Because XML data contains no information about how information is to be has become one of the most popular XML sites. Validity is determined by a validating parser (see). FileMaker Developer 5 Author custom solutions for the Web.unc. W3C The World Wide Web Consortium. and any resemblance to existing persons and companies is purely coincidental. XSLT Part of the XSL formatting language. CA 95054 http://www. and links to 3rd party resources. He lectures about Java and object oriented programming at Polytechnic University in Brooklyn. FileMaker Pro 5 Unlimited Includes FileMaker Pro FileMaker Developer 5 Includes FileMaker Pro If you use FileMaker Pro 5 with other FileMaker FileMaker Product Family FileMaker Pro 5 Enables a single user to create. Product specifications and availability subject to change without notice. manage and share information and projects in workgroups of up to 10 guests. Menton of third party products and companies is for informational purposes only and does not constitute an endorsement nor recommendation.† FileMaker Pro 5 FileMaker Server 5 FileMaker Pro 5 Unlimited Unlimited sharing of FileMaker files over the Web with built-in support for leading Web servers. FileMaker Pro.unc. to transform the XML that FileMaker Pro generates into HTML for display in a browser. ABOUT THE AUTHOR Elliotte Rusty Harold is an internationally respected writer.S. His Cafe au Lait web site at http://metalab. and educator. Inc. the organization dedicated to standardizing WWW technologies. All rights reserved. Portions of some screen shots are reprinted by permission from Microsoft Corporation. See the Technology Preview’s section on Formatting XML documents for the uses. See the Technology Preview’s section on Formatting XML documents for details.The most commonly used of its two parts.TECHNOLOGY OVERVIEW – FILEMAKER PRO AND XML Style sheet A style sheet determines the appearance and formatting of elements in the set of documents that references it.filemaker. or into an agreedupon standard for data exchange. Portions of some screen shots are copyright 1996-2000 Netscape Communications Corp. FileMaker is a trademark of FileMaker. †Each FileMaker Pro guest requires an additional licensed copy of FileMaker Pro. XSL A language used to write style sheets to format or transform data in XML documents. registered in the U. Inc. FileMaker. and cons of this and other formatting methods. and his spin-off site Cafe con Leche at http://metalab. validating parser An application program (such as the one contained in Microsoft Internet Explorer 5) that evaluates an XML document to be sure it is valid (see). programmer.These screen shots may not be reprinted or copied without the express written permission of Netscape. All other trademarks are the property of their respective owners.