13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

9.4 A Sample Ant Buildfile221standards, such as W3C’s XML Schema. In either case, the DTD or schemaspecify what tags may be used in the markup, where they may exist with respectto <strong>on</strong>e another, what attributes tags may have, and how many times a given tagmay appear in a given place. A document can thus be validated—that is,checked against the corresp<strong>on</strong>ding DTD or schema. It’s not necessary, however;in many situati<strong>on</strong>s, documents can also be used without validati<strong>on</strong> so l<strong>on</strong>g asthey are well-formed—that is, c<strong>on</strong>form to the basic syntax of XML.HTML, with which even n<strong>on</strong>programmers are familiar, is an instance ofa markup language defined in terms of SGML (and XHTML is its reformulati<strong>on</strong>in terms of XML). This book itself was written in Docbook, which isanother SGML markup language.So, if SGML is such a w<strong>on</strong>der, why is XML all the rage? Well, SGML is<strong>on</strong>e of those standards that attempt to “subsume the world.” SGML has verycomplex and flexible syntax, with many different ways to represent a simplemarkup c<strong>on</strong>struct. Thus, to completely implement an SGML parser is difficult.Recognizing that 90% of the complexity of SGML is needed in <strong>on</strong>ly about 1%of cases, the designers of XML realized that they could make a markup specificati<strong>on</strong>language <strong>on</strong>ly 10% as complicated that would cover 99% of cases (ofcourse, like 85% of statistics, we’re making these numbers up, but you getthe point).Implementing an XML parser, while not exactly trivial, is much easierthan implementing an SGML parser.SGML/DSSSL and XML/XSLT are efforts to make the transformati<strong>on</strong>and presentati<strong>on</strong> of hierarchical data easier and more standardized. If whatyou have read here is all that you know about XML (or SGML), you shouldcertainly c<strong>on</strong>sider getting yourself a book <strong>on</strong> these important standards.For now, we can say that XML c<strong>on</strong>sists of tags which are set off from datac<strong>on</strong>tent by the familiar less-than and greater-than brackets we are used to seeingin HTML:Just as in HTML, the tags may have start tag and end tag forms:Sample XML tagged dataThe entire c<strong>on</strong>struct, including the pair of matching tags and everythinginside them, is called an element. The start tags may also, like in HTML, carrydata inside them in the form of attributes:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!