Debian Codegraph @

FleXML.html

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html>
5 <head>
6 <title>FleXML - An XML Processor Generator</title>
7
8 <style type="text/css">
9 <!--
10 A:link { text-decoration:none }
11 A:visited { text-decoration:none }
12 A:active { text-decoration:none }
13 A:hover { text-decoration:underline; color:#FF0000 }
14
15 .tabs { color: #000000; }
16 .tabs:visited { color: #000000; }
17 .tabs:hover { color:#FF0000; }
18 -->
19 </style>
20 </head>
21
22 <body>
23
24
25
26 <table>
27 <tr valign='top'><td>
28 <p style='font-size:0.8em'><a href="http://sourceforge.net">
29 <img src="http://sourceforge.net/sflogo.php?group_id=34654&amp;type=1" width="88"
30 height="31" alt="SourceForge Logo" /></a><br />
31 <i>Visit our Sponsor</i></p>
32
33 <hr style="height:1px" />
34 <p style='font-size:0.9em'>
35 <b><a class='tabs' href="http://sourceforge.net/projects/flexml/">Project Summary</a></b><br />
36 <!-- <a class='tabs' href="http://flexml.sourceforge.net">Home Page</a><br> -->
37 <a class='tabs' href="http://sourceforge.net/forum/?group_id=34654">Forums</a><br/>
38 <a class='tabs' href="http://sourceforge.net/tracker/?group_id=34654">Tracker</a><br/>
39 <a class='tabs' href="http://sourceforge.net/tracker/?group_id=34654&amp;atid=411869">Bugs</a><br/>
40 <a class='tabs' href="http://sourceforge.net/tracker/?group_id=34654&amp;atid=411870">Support</a><br/>
41 <a class='tabs' href="http://sourceforge.net/tracker/?group_id=34654&amp;atid=411871">Patches</a><br/>
42 <a class='tabs' href="http://sourceforge.net/mail/?group_id=34654">Lists</a><br/>
43 <a class='tabs' href="http://sourceforge.net/pm/?group_id=34654">Tasks</a><br/>
44 <a class='tabs' href="http://sourceforge.net/docman/?group_id=34654">Docs</a><br/>
45 <a class='tabs' href="http://sourceforge.net/news/?group_id=34654">News</a><br/>
46 <a class='tabs' href="http://sourceforge.net/cvs/?group_id=34654">CVS</a><br/>
47 <a class='tabs' href="http://sourceforge.net/project/showfiles.php?group_id=34654">Files</a><br/>
48 </p>
49 <hr style="height:1px" /><br/>
50
51 </td><td>
52
53 <h1> FleXML - XML Processor Generator </h1>
54
55 <blockquote><p><em>
56 See also <a href="flexml.html">the manual page</a>
57 and a short <a href="paper.html">white paper</a>.
58 <!-- and a short <a href="http://sourceforge.net/docman/display_doc.php?docid=6373&amp;group_id=34654">white paper</a>.-->
59 Or peek into the
60 <a href="http://sourceforge.net/cvs/?group_id=34654">
61 master source archive</a>.
62 </em></p></blockquote>
63
64 <p>
65 FleXML reads a DTD (Document Type Definition)
66 describing the format of XML (Extensible Markup Language)
67 documents; it may be specified as a URI to the DTD on the
68 web. From this FleXML produces a validating XML
69 processor with an interface to support XML applications. Proper
70 applications can be generated optionally from special action
71 files, either for linking or textual combination with the
72 processor.
73 </p>
74
75 <p>
76 FleXML is specifically developed for XML applications
77 where a fixed data format suffices in the sense that a single
78 DTD is used without individual extensions for a large number of
79 documents. (Specifically it restricts XML rule [28] to
80 </p>
81
82 <pre> [28r] doctypedecl ::= '<code>&lt;!DOCTYPE</code>' S Name S ExternalID S? '<code>&gt;</code>'
83 </pre>
84
85 <p>
86 where the ExternalId denotes the used DTD - one might say, in
87 fact, that FleXML implements ``non-extensible'' markup. :)
88 </p>
89
90 <p>
91 With this restriction we can do much better because the possible
92 tags and attributes are static: FleXML-generated XML processors
93 read the XML document character by character and can immediately
94 dispatch the actions associated with each element (or reject the
95 document as invalid). Technically this is done by using the
96 Flex scanner generator to produce a deterministic finite
97 automaton with an element context stack for the DTD, which means
98 that there is almost no overhead for XML processing.
99 </p>
100
101 <p>
102 Furthermore we have devised a simple extension of the C
103 programming language that facilitates the writing of `element
104 actions' in C, making it easy to write really fast XML
105 applications. In particular we represent XML attribute values
106 efficiently in C when this is possible, thus avoiding the
107 otherwise ubiquitous conversions between strings and data
108 values.
109 </p>
110
111 <p>
112 Compared to SAX and its XSL-based friends, FleXML immediately
113 produces efficient code in that the interdiction of extension
114 makes it possible to encode efficiently, FleXML for example uses
115 native C `enum' types to implement enumeration attribute
116 types. However, the above limitation does prevent uses in more
117 complex settings.
118 </p>
119
120 <p>
121 As an example: the following is all that is needed to produce a
122 fast program that prints all href-attributes in
123 <code>&lt;a...&gt;</code> tags in XHTML documents (and rejects
124 invalid XHTML documents).
125 </p>
126
127 <pre><code> &lt;!DOCTYPE actions SYSTEM "flexml-act.dtd"&gt;
128 &lt;actions&gt;
129 &lt;top&gt;&lt;![CDATA[ #include &lt;stdio.h&gt; ]]&gt;&lt;/top&gt;
130 &lt;start tag='a'&gt;&lt;![CDATA[ if ({href}) printf("%s\n", {href}); ]]&gt;&lt;/start&gt;
131 &lt;/actions&gt;
132 </code></pre>
133
134 <p>
135 In general, action files are themselves XML documents conforming
136 to the DTD
137 </p>
138
139 <pre><code> &lt;!ELEMENT actions ((top|start|end)*,main?)&gt;
140 &lt;!ENTITY % C-code "(#PCDATA)"&gt;
141 &lt;!ELEMENT top %C-code;&gt;
142 &lt;!ELEMENT start %C-code;&gt; &lt;!ATTLIST start tag NMTOKEN #REQUIRED&gt;
143 &lt;!ELEMENT end %C-code;&gt; &lt;!ATTLIST end tag NMTOKEN #REQUIRED&gt;
144 &lt;!ELEMENT main %C-code;&gt;
145 </code></pre>
146
147 <p>
148 with <code>%C-code;</code> segments being in C enriched as
149 described below. The elements are used as follows:
150 </p>
151
152 <dl>
153 <dt>top</dt>
154 <dd><p>
155 Use for top-level C code such as global declarations, utility
156 functions, etc.
157 </p></dd>
158
159 <dt>start</dt>
160 <dd>
161 <p>
162 Attaches the code as an action to the element with the name
163 of the required ``tag'' attribute. The ``%C-code;''
164 component should be C code suitable for inclusion in a C
165 block (i.e., within {...} so it may contain local
166 variables); furthermore the following extensions are
167 available: {attribute} Can be used to access the value of
168 the attribute as set with attribute=value in the start
169 tag. In C, {attribute} will be interpreted depending on the
170 declaration of the attribute. If the attribute is declared
171 as an enumerated type like
172 </p>
173
174 <pre><code> &lt;!ATTLIST attrib (alt1 | alt2 |...) ...&gt;
175 </code></pre>
176
177 <p>
178 then the C attribute value is of an enumerated type with the
179 elements written <code>{attrib=alt1}</code>,
180 <code>{attrib=alt2}</code>, etc.; furthermore an unset
181 attribute has the ``value'' <code>{!attrib}</code>. If the
182 attribute is not an enumeration then <code>{attrib}</code>
183 is a null-terminated C string (of type <code>char*</code>)
184 and <code>{!attrib}</code> is <code>NULL</code>.
185 </p>
186 </dd>
187
188 <dt>end</dt>
189 <dd>
190 <p>
191 Similarly attaches the code as an action to the end tag with
192 the name of the required ``tag'' attribute; also here the
193 ``%C-code;'' component should be C code suitable for
194 inclusion in a C block. In case the element has ``Mixed''
195 contents, i.e, was declared to permit <code>#PCDATA</code>,
196 then the special variable <code>{#PCDATA}</code> contains
197 the text (<code>#PCDATA</code>) of the element as a
198 null-terminated C string (of type char*). In case the Mixed
199 contents element actually mixed text and child elements then
200 <code>{#PCDATA}</code> contains the plain concatenation of
201 the text fragments as one string.
202 </p>
203 </dd>
204
205 <dt>main</dt>
206 <dd>
207 <p>
208 Finally, an optional ``main'' element can contain the C main
209 function of the XML application. Normally the main function
210 should include (at least) one call of the XML processor
211 <code>yylex</code>.
212 </p>
213 </dd>
214
215 </dl>
216 <p>
217 The program is freely redistributable and modifiable (under GNU
218 `copyleft').
219 </p>
220 <hr />
221 <address>Copyright (C)
222 <a href="mailto:[email protected]">Kristoffer Rose</a>.
223 <!-- Created: Thu Dec 9 08:09:41 CET 1999 -->
224 <!-- hhmts start -->Last modified: Tue Feb 11 18:06:44 EST 2003 <!-- hhmts end -->
225 </address>
226
227 </td></tr></table>
228
229 <p style='font-size:0.8em'>$Id: FleXML.html,v 1.5 2005/04/06 10:05:15 mquinson Exp $</p>
230 </body>
231 </html>