⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch02_01.htm

📁 Perl & XML. by Erik T. Ray and Jason McIntosh ISBN 0-596-00205-X First Edition, published April
💻 HTM
📖 第 1 页 / 共 2 页
字号:
"GML."</p> </blockquote><p>Goldfarb went on to lead a standards team at the<a name="INDEX-61" /> <a name="INDEX-62" />American NationalStandards Institute (ANSI) to make the power of GML available to theworld. Building on the GML and GenCode projects, the committeeproduced the Standard Generalized Markup Language (SGML). Quicklyadopted by the U.S. Department of Defense and the Internal RevenueService, SGML proved to be a big success. It became an internationalstandard when ratified by the ISO in 1986. Since then, manypublishing and processing packages and tools have been developed.</p><p>Generic coding was a breakthrough for digital content. Finally,content could be described for what it was, instead of how to displayit. Something like this looks more like a database than aword-processing file:</p><blockquote><pre class="code">&lt;personnel-record&gt;  &lt;name&gt;    &lt;first&gt;Rita&lt;/first&gt;    &lt;last&gt;Book&lt;/last&gt;  &lt;/name&gt;  &lt;birthday&gt;    &lt;year&gt;1969&lt;/year&gt;    &lt;month&gt;4&lt;/month&gt;    &lt;day&gt;23&lt;/day&gt;  &lt;/birthday&gt;&lt;/personnel-record&gt;</pre></blockquote><p>Notice the lack of presentational information. You can format thename any way you want: first name then last name, or last name first,with a comma. You could format the date in American style (4/23/1969)or European (23/4/1969) simply by specifying whether the<tt class="literal">&lt;month&gt;</tt> or <tt class="literal">&lt;day&gt;</tt>element should present its contents first. The documentdoesn't dictate its use, which makes it useful as asource document for multiple destinations.</p><p>In spite of its revolutionary capabilities, SGML never really caughton with small companies the way it did with the big ones. Software isexpensive and bulky. It takes a team of developers to set up andconfigure a production environment around SGML. SGML feelsbureaucratic, confusing, and resource-heavy. Thus, SGML in itsoriginal form was not ready to take the world by storm.</p><p>"Oh really," you say."Then what about HTML? Isn't ittrue that <a name="INDEX-63" />HTML is an application ofSGML?" HTML, that celebrity of the Internet, theharbinger of hypertext and workhorse of the <a name="INDEX-64" />WorldWide Web, is indeed an application of SGML. By application, we meanthat it is a markup language derived with the rules of SGML. SGMLisn't a markup language, but a toolkit for designingyour own descriptive markup language. Besides HTML, languages forencoding technical documentation, IRS forms, and battleship manualsare in use.</p><p>HTML is indeed successful, but it has limitations.It's a very small language, and not verydescriptive. It is closer to troff in function than to<a name="INDEX-65" />DocBook and otherSGML applications. It has tags like <tt class="literal">&lt;i&gt;</tt> and<tt class="literal">&lt;b&gt;</tt> that change the font style withoutsaying why. Because HTML is so limited and at least partlypresentational, it doesn't represent an overwhelmingsuccess for SGML, at least not in spirit. Instead of bringing thepower of generic coding to the people, it brought another one-trickpony, in which you could display your content in a particular venueand couldn't do much else with it.</p><p>Thus, the standards folk decided to try again and see if theycouldn't arrive at a compromise between thedescriptive power of SGML and the simplicity of HTML. They came upwith the Extensible Markup Language (XML). The"X" stands for"extensible," pointing out thefirst obvious difference from HTML, which is that some people thinkthat "X" is a cooler-soundingletter than "E" when used in anacronym. The second and more relevant difference is that yourdocuments don't have to be stuck in the anemic tagset of HTML. You can extend the tag namespace to be as descriptive asyou want -- as descriptive, even, as SGML. Voil&agrave;! Thebridge is built.</p><p>By all accounts, XML is a smashing success. It has lived up to thehype and keeps on growing: XML-RPC, XHTML, SVG, and DocBook XML aresome of its products. It comes with several accessories, includingXSL for formatting, XSLT for transforming, XPath for searching, andXLink for linking. Much of the standards work is under the auspicesof the <a name="INDEX-66" /> <a name="INDEX-67" />World Wide Web Consortium (W3C), anorganization whose members include Microsoft, Sun, IBM, and manyacademic and public institutions.</p><p>The W3C's mandate is to research and foster newtechnology for the Internet. That's a rather broadstatement, but if you visit their site at <a href="http://www.w3.org/">http://www.w3.org/</a> you'llsee that they cover a lot of bases. The W3C doesn'tcreate, police, or license standards. Rather, they makerecommendations that developers are encouraged, but not required, tofollow.<a href="#FOOTNOTE-4">[4]</a></p><blockquote class="footnote"> <a name="FOOTNOTE-4" /><p>[4]When a trusted body like the W3C makes arecommendation, it often has the effect of a law; many developersbegin to follow the recommendation upon its release, and developerswho hope to write software that is compatible with everyoneelse's (which is the whole point behind standardslike XML) had better follow the recommendation as well.</p></blockquote><p>However, the system remains open enough to allow healthy dissent,such as the recent and interesting case of XML Schema, a W3C standardthat has generated controversy and competition.We'll examine this particular story further in <a href="ch03_01.htm">Chapter 3, "XML Basics: Reading and Writing"</a>. It's strong enough to betaken seriously, but loose enough not to scare people away. Therecommendations are always available to the public.</p><p>Every developer should have working knowledge of XML, sinceit's the universal packing material for data, and somany programs are all about crunching data. The rest of this chaptergives a quick introduction<a name="INDEX-68" /> to XML<a name="INDEX-69" /> for developers.</p></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch01_06.htm"><img alt="Previous" border="0" src="../gifs/txtpreva.gif" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img alt="Home" border="0" src="../gifs/txthome.gif" /></a></td><td align="right" valign="top" width="228"><a href="ch02_02.htm"><img alt="Next" border="0" src="../gifs/txtnexta.gif" /></a></td></tr><tr><td align="left" valign="top" width="228">1.6. XML Gotchas</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img alt="Book Index" border="0" src="../gifs/index.gif" /></a></td><td align="right" valign="top" width="228">2.2. Markup, Elements, and Structure</td></tr></table></div><hr width="684" align="left" /><img alt="Library Navigation Links" border="0" src="../gifs/navbar.gif" usemap="#library-map" /><p><p><font size="-1"><a href="copyrght.htm">Copyright &copy; 2002</a> O'Reilly &amp; Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -