Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 36 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
36
Dung lượng
517 KB
Nội dung
XML, The Good, the Bad, and the U gly 1 XML The Good, the Bad, and the Ugly XML, The Good, the Bad, and the Ugly 2 XML Process Overview XML, The Good, the Bad, and the Ugly 3 XML XML, The Good, the Bad, and the Ugly 4 XML Process in Motion Showtime!! XML, The Good, the Bad, and the Ugly 5 XML: Overview XML does NOT DO Anything! XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to describe data XML tags are not predefined. You must define your own tags XML uses an XML Schema or a Document Type Definition (DTD) to describe the data (yeah, but…). XML with an XML Schema or a DTD is designed to be self-descriptive. (whatever that means…) XML, The Good, the Bad, and the Ugly 6 XML Overview: Elements Data is Divided into Elements <ARGUMENT> <FACT>One way to learn a language is to immerse yourself in it.</FACT> <FACT>If you’re reading this, you’re immersed in XML.</FACT> <CONCLUSION>One way to learn XML is to read this.</CONCLUSION> </ARGUMENT> <ARGUMENT> <FACT>I made up these tags to suit my purpose.</FACT> <FACT>My purpose was to help you read XML.</FACT> <CONCLUSION>I made up these tags to help you.</CONCLUSION> </ARGUMENT> XML, The Good, the Bad, and the Ugly 7 XML Overview: Root Element One Root Element <EXAMPLES_OF_LOGIC> <ARGUMENT> <FACT>One way to learn a language is to immerse yourself in it.</FACT> <FACT>If you’re reading this, you’re immersed in XML.</FACT> <CONCLUSION>One way to learn XML is to read this.</CONCLUSION> </ARGUMENT> <ARGUMENT> <FACT>I made up these tags to suit my purpose.</FACT> <FACT>My purpose was to help you read XML.</FACT> <CONCLUSION>I made up these tags to help you.</CONCLUSION> </ARGUMENT> </EXAMPLES_OF_LOGIC> XML, The Good, the Bad, and the Ugly 8 XML Overview: Empty Elements Empty, but not forgotten <EXAMPLES_OF_LOGIC> <ARGUMENT> <FACT>One way to learn a language is to immerse yourself in it.</FACT> <FACT>If you’re reading this, you’re immersed in XML.</FACT> <CONCLUSION>One way to learn XML is to read this.</CONCLUSION> </ARGUMENT> <ARGUMENT/> <ARGUMENT> <FACT>I made up these tags to suit my purpose.</FACT> <FACT>My purpose was to help you read XML.</FACT> <CONCLUSION>I made up these tags to help you.</CONCLUSION> </ARGUMENT> </EXAMPLES_OF_LOGIC> XML, The Good, the Bad, and the Ugly 10 XML Overview: Attributes Properties by another name <EXAMPLES_OF_LOGIC> <ARGUMENT convincing="Yes"> <FACT>All virtues are laudable.</FACT> <FACT>Kindness is a virtue.</FACT> <CONCLUSION>Kindness is laudable.</CONCLUSION> </ARGUMENT> <ARGUMENT convincing="No"/> <ARGUMENT convincing="No"> <FACT>Socrates was a man.</FACT> <FACT>All men are created equal.</FACT> <CONCLUSION>Socrates was Plato.</CONCLUSION> </ARGUMENT> </EXAMPLES_OF_LOGIC> XML, The Good, the Bad, and the Ugly 11 XML Overview: Declarations (Duuude, I'm XML!) Declare that a file contains XML and conforms to version 1.0 (the current and only version, but hey!) <?xml version="1.0"?> (location: if used, line 1 always) Declare other attributes character encoding scheme <?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="iso-8859-1"?> [...]... transforming XML documents XPath: A language for defining or filtering parts of an XML document XSL-FO: A language for formatting XML documents XML, The Good, the Bad, and the Ugly 20 XSLT Overview: eXtensible Stylesheet Language Purpose (porpoise, papoose): Transform XML data to some type of output format – html files, PDF files, another xml file, etc for presentation Specialized XML vocabulary... be applied to one xml file to create multiple outputs Separate Data from Presentation XML, The Good, the Bad, and the Ugly 21 < ?xml version="1.0"?> Building Blocks of XML: A Teacher Guide Building Blocks of XML: A Teacher Guide... and the Ugly 26 XML Uses: The Good Stuff Web: Table of Contents, table oriented data Word and Excel import/export DocBook Schemas and Transforms RoboHelp import/export XSL-FO to PDF XML, The Good, the Bad, and the Ugly 27 XML, The Good, the Bad, and the Ugly 28 XML, The Good, the Bad, and the Ugly 29 XML, The Good, the Bad, and the Ugly 30 XML : The Bad What They Never Tell You XML, The Good,... required to display XML data (!) XML, The Good, the Bad, and the Ugly 24 XSD Schema Example Take a look at your schema handout for an example of a schema Go to www.w3schools.com and Microsoft for more information about schema construction XML, The Good, the Bad, and the Ugly 25 XML Transformation: Example View a real life XML transform See how the components fit together XML, The Good, the Bad,.. .XML Components So Far One root element One or more elements (can be nested) Empty Elements optional Attributes optional XML declaration—optional XML, The Good, the Bad, and the Ugly 12 XML Overview: Namespaces Where is Martha Stewart when you need her?? (And what ARE these?) An XML good thing: you get to name your data elements An XML bad thing: everybody... and the Ugly 31 XML: The BAD How DOES XML Get Displayed????? Things they don't tell you… No shoes, no shirt, no display Requires XML- aware software and the extra stuff necessary to display it Special encoding and character display Using CSS XML, The Good, the Bad, and the Ugly 32 XML Display Gotchas Special characters like < > & and others need special handling so that the xml parser doesn’t... get confused and think they are part of the XML data b > c ]]> Character encoding—most of the time a non issue < ?xml version="1.0" encoding="utf-8"?> Handling blank spaces XML, The Good, the Bad, and the Ugly 33 XML: The Ugly My Data, YOUR Browser Browsers use different ways of displaying XML (requires browser detection) How the heck does XML actually GET displayed??? Client display... related technologies Microsoft (oh, yes!) http://msdn.microsoft.com /xml/ www.siteexperts.com (cf Building Documents with XML, XSL, and CSS) DOCBook: www.docbook.org and www.docbook.sourceforge.net http://www.codehound.com /xml/ XML, The Good, the Bad, and the Ugly 39 XML Tools and Editors Free, free, free http://architag.com/xray/ XML, The Good, the Bad, and the Ugly 40 ... XML, The Good, the Bad, and the Ugly 22 XSD: eXtensible Stylesheet Definition XML, The Good, the Bad, and the Ugly 23 XSD Overview: Schema Pupose Purpose: A schema is an XML file that describes the structure of an XML data file and the rules for what kind of data can be stored there Valid XML: A file that conforms to the structure and rules... about Browser detection < ?xml version="1.0" encoding="iso-8859-1"?> < ?xml- stylesheet type="text/xsl" href="exchangerates.xsl"?> < ?xml- stylesheet type="text/css" href="help_style.css"? > XML, The Good, the Bad, and the Ugly 35 My Data, YOUR Browser Are You Being Served? Server or Client Display if (isServerBased()) { // Do some Server display } else { // Do Client display } XML, The Good, the Bad, and . XML, The Good, the Bad, and the U gly 1 XML The Good, the Bad, and the Ugly XML, The Good, the Bad, and the Ugly 2 XML Process Overview XML, The Good, the Bad, and the Ugly 3 XML XML,. and the Ugly 4 XML Process in Motion Showtime!! XML, The Good, the Bad, and the Ugly 5 XML: Overview XML does NOT DO Anything! XML stands for EXtensible Markup Language XML is a markup. is a markup language much like HTML XML was designed to describe data XML tags are not predefined. You must define your own tags XML uses an XML Schema or a Document Type Definition