3.2 Elements in the DTD

3.1 Creating a Basic XML Document Containing a DTD

You can create your own Document Type Definitions using the suggestions in this chapter. Begin an XML document with a prolog containing the Document Type Declaration and define at least one element. The first ELEMENT definition matches the document type and is the root element of the XML document. Your definitions may list elements, attributes, entities, and notations. The specific requirements for each of these definitions are listed in your particular document. The name of the XML document does not need to match the root element or DOCTYPE; it is only used in Listing 3.3 for convenience.

Listing 3.3: mydoc.xml

start example
 <?xml version="1.0" standalone="yes"?> <!DOCTYPE mydoc [ <!ELEMENT mydoc ANY> list your definitions here ]> <mydoc> </mydoc>
end example

3.11 The Relationship between DTD Element Names and FileMaker Pro Field Names

When creating the definitions, you can use the field names in your FileMaker Pro database as the ELEMENT names. Remember the previous cautions about naming elements and attributes with no spaces and using only alphanumeric characters in these names. When FileMaker Pro publishes XML with the FMPDSORESULT, it converts spaces in field names to underscores and may convert other characters. A field named "oSlash" is acceptable but gets converted with a double-byte character to "oSlash√π." The field name "tilde" or "pipename" may stop the XML parser. Also, try to avoid elements or field names that begin with "x", "m", and "l" (upper-or lowercase), because these are reserved and may cause unpredictable results if used at the beginning of element names.

Exercise 3.1: Check Your Field Names

Run tests with one record published to XML to see if there may be a problem with your field names.

Export from your database one record using FMPDSORESULTS. Look at the field names.

Run the same test with FMPXMLRESULTS and notice the difference. The XML processor is less likely to get stuck on the field names "oSlash", "tilde", or "pipename" when using FMPXMLRESULTS. The differences in these two Document Type Definitions will be discussed in Chapter 4.

Another test can be done to verify how a field name may look to the web browser. Create a calculated text field named cFieldsHTTP with the following formula:

 Substitute(Substitute(External("Web-ToHTTP", FieldNames(Status   (CurrentFileName), Status(CurrentLayoutName))), "%0" & "d", "¶"), "%0"   & "a", "")

Web Companion must be enabled to use this External function. To see the field names as a list, the end-of-line characters have been converted back to the return-in-field character (¶).

These tests can help tell you if your field names are acceptable or may cause problems as DTD element names. Also, look at the results you get when you display the ASCII characters on the web. Exercises 1.2 and 2.1 can help you see what will happen to your element names with XML Export or XML web publishing in FileMaker Pro.



Filemaker Pro 6 Developer's Guide to XML(s)XSL
FileMaker Pro 6 Developers Guide to XML/XSL (Wordware Library for FileMaker)
ISBN: 155622043X
EAN: 2147483647
Year: 2003
Pages: 100
Authors: Beverly Voth

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net