📄 0260-0262.html
字号:
<!DOCTYPE HTML PUBLIC "html.dtd"><HTML><HEAD><TITLE>Presenting XML:Developing an XML Memo Application:EarthWeb Inc.-</TITLE><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><SCRIPT><!--function displayWindow(url, width, height) { var Win = window.open(url,"displayWindow",'width=' + width +',height=' + height + ',resizable=1,scrollbars=yes');}//--></SCRIPT></HEAD><BODY BGCOLOR="#FFFFFF" VLINK="#DD0000" TEXT="#000000" LINK="#DD0000" ALINK="#FF0000"><TD WIDTH="540" VALIGN="TOP"><!-- <CENTER><TABLE><TR><TD><FORM METHOD="GET" ACTION="http://search.itknowledge.com/excite/cgi-bin/AT-foldocsearch.cgi"><INPUT NAME="search" SIZE="20" VALUE=""><BR><CENTER><INPUT NAME="searchButton" TYPE="submit" VALUE="Glossary Search"></CENTER><INPUT NAME="source" TYPE="hidden" VALUE="local" CHECKED> <INPUT NAME="bltext" TYPE="hidden" VALUE="Back to Search"><INPUT NAME="sp" TYPE="hidden" VALUE="sp"></FORM></TD><TD><IMG SRC="http://www.itknowledge.com/images/dotclear.gif" WIDTH="15" HEIGHT="1"></TD><TD><FORM METHOD="POST" ACTION="http://search.itknowledge.com/excite/cgi-bin/AT-subscriptionsearch.cgi"><INPUT NAME="search" SIZE="20" VALUE=""><BR><CENTER><INPUT NAME="searchButton" TYPE="submit" VALUE=" Book Search "></CENTER><INPUT NAME="source" TYPE="hidden" VALUE="local" CHECKED> <INPUT NAME="backlink" TYPE="hidden" VALUE="http://search.itknowledge.com:80/excite/AT-subscriptionquery.html"><INPUT NAME="bltext" TYPE="hidden" VALUE="Back to Search"><INPUT NAME="sp" TYPE="hidden" VALUE="sp"></FORM></TD></TR></TABLE></CENTER> --><!-- ISBN=1575213346 //--><!-- TITLE=Presenting XML//--><!-- AUTHOR=Richard Light//--><!-- PUBLISHER=Macmillan Computer Publishing//--><!-- IMPRINT=Sams//--><!-- CHAPTER=13 //--><!-- PAGES=0235-0262 //--><!-- UNASSIGNED1 //--><!-- UNASSIGNED2 //--><P><CENTER><A HREF="0255-0259.html">Previous</A> | <A HREF="../ewtoc.html">Table of Contents</A> | <A HREF="../ch14/0263-0268.html">Next</A></CENTER></P><A NAME="PAGENUM-260"><P>Page 260</P></A><P>Listing 13.4. continued</P><!-- CODE //--><PRE>(define (para-with-prefix prefix) (make paragraph use: header-line-style (make line-field field-width: 50pt (literal prefix)) (process-children-trim)))(default (process-children-trim))(element MEMO (make sequence use: memo-style (process-children-trim)))(element P (make paragraph use: para-style space-before: 10pt))(element main-heading (make paragraph use: heading-style space-before: 20pt))(element sender (para-with-prefix "From:"))(element recipient (para-with-prefix "To:"))(element date (para-with-prefix "Date:"))(element sender (para-with-prefix "From:"))(element recipient (para-with-prefix "To:"))(element date (para-with-prefix "Date:"))(element links (empty-sosofo))(element anchor (make paragraph (literal "[fragment of original message was here]")))</PRE><!-- END CODE //--><A NAME="PAGENUM-261"><P>Page 261</P></A><TABLE BGCOLOR="#FFFF99"><TR><TD>Note:</TD></TR><TR><TD><BLOCKQUOTE>The style sheet actually doesn't deal with all of the concepts in thememo DTD. However, there isn't space in this overview to deal with all theissues that this DTD raises, such as nested divisions and different types of lists.</BLOCKQUOTE></TD></TR></TABLE><H3><A NAME="ch13_ 24">System Requirements</A></H3><P>Apart from the system requirements that I reviewed when looking at theinitial scenario at the start of this chapter, it is clear that any real-life XMLapplication will impose certain demands on its support software. Now look atthese issues for editors and browsers that your simple memo application has raised.</P><H4><A NAME="ch13_ 25">Editor Requirements</A></H4><P>In thinking through the design of an XML DTD for memos, you havecome across a considerable number of areas where the XML editor can play animportant role. (I assume, as a starting point, that the editor is able tointerpret an XML DTD and that it will support the addition of XML markup in auser-friendly manner.)</P><P>The following are some requirements that were raised:</P><UL><LI> Data validation (possibly in association with an external database)<LI> Insertion of the current date on request<LI> Automatic assignment of a uniqueID to every element<LI> Automatic insertion of elements and attributes that are required bythe DTD<LI> Capability of creating out-of-line links in a user-friendly manner</UL><P>In addition, you might expect, in your memo application in particular,there to be a facility to create a reply to a memo, where thesender and recipient are automatically entered, the date is filled in automatically, and themain-heading is copied from the source memo. However, this job need not becarried out by the XML editor.</P><A NAME="PAGENUM-262"><P>Page 262</P></A><H4><A NAME="ch13_ 26">Browser Requirements</A></H4><P>What about XML browsers? Here, the memo example doesn't really makeany brand-new demands on the software, but it does emphasize the importanceof the following aspects of the XML specification:</P><UL><LI> Full support for XPointers (including traversal)<LI> Built-in support for XS style sheets<LI> Capability of using style sheets to render fragments of XMLdocuments that are embedded within another document (possiblyconforming to a different DTD)</UL><H3><A NAME="ch13_ 27">Summary</A></H3><P>In this chapter, you have put theory into practice by developing an XMLapplication for memos. This application demonstrates the potential usefulnessof XML's out-of-line links and XPointers.</P><P>You started by analyzing the information that could occur within a memoand then designed a DTD that is flexible enough to cope with a wide rangeof possible formats. During the course of this example, you found that youcan use out-of-line links to represent the connection between replies and thepart of the original memo to which they are a response.</P><P>You then marked up the sample memo according to this DTD. Finally,you devised an XS style sheet that will render the memos on paper or on the screen.<P><CENTER><A HREF="0255-0259.html">Previous</A> | <A HREF="../ewtoc.html">Table of Contents</A> | <A HREF="../ch14/0263-0268.html">Next</A></CENTER></P></TD></TR></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -