Download presentation
Presentation is loading. Please wait.
Published byEzra Cobb Modified over 8 years ago
1
Appendix C: Brief Overview of XML
2
©SoftMoore ConsultingSlide 2 What is XML? The eXtensible Markup Language (XML) is a meta-markup language; i.e., a language used for defining markup languages. a set of rules for defining semantic tags that describe structured data.
3
©SoftMoore ConsultingSlide 3 Characteristics of XML Text based Self describing Human (sort of) and machine readable Fully buzzword compliant standard –open– non-proprietary –platform-independent– vendor-neutral –license-free– well-supported Extensible (can define new tags) Hierarchical structure
4
©SoftMoore ConsultingSlide 4 Composition of an XML Document Markup –elements (defined by tags; e.g.,... ) –attributes –entity references (similar to macro substitution) –comments –processing instructions –CDATA sections –document type declaration Content (information between start and end tags) Note: Whitespace within content is never ignored.
5
©SoftMoore ConsultingSlide 5 Example: XML Document Hello, world.
6
©SoftMoore ConsultingSlide 6 Viewing the Example as a Tree greeting salutationendPunctuationdelimitertarget Hello,world. markup content
7
©SoftMoore ConsultingSlide 7 Elements Basic building blocks of XML markup Defined by tags; e.g.,... –both start and end tags are required –exception: empty tag; e.g., May contain –other elements (nested, hierarchical structure) –content (character data) –character and entity references –processing instructions –comments –CDATA sections
8
©SoftMoore ConsultingSlide 8 Entities Entities provide a macro-like substitution capability for XML Entities can be defined in a Document Type Definition (to be covered later) An entity reference is replaced by the entity value when the XML document is parsed... &smc;... A character reference can be used to display a specific character; e.g., ©
9
©SoftMoore ConsultingSlide 9 Predefined XML Entities Entity ReferenceCharacter << && >> ' ' (apostrophe) " " (quotation mark)
10
©SoftMoore ConsultingSlide 10 Character Data The textual content of an element or an attribute value Can’t contain the characters –less-than (‘<‘)use < –ampersand (‘&’) use &
11
©SoftMoore ConsultingSlide 11 Attributes Name-value pairs attached to elements Must always be quoted –quotation marks ( " ) –apostrophes ( ' ) Examples –language="English" –language='English' Using attributes versus elements –Choice not always obvious. –Should language be an attribute or an element?
12
©SoftMoore ConsultingSlide 12 Comments Basic syntax May appear anywhere in a document outside of other markup Restrictions –can’t include two consecutive hyphens (“--”) –can’t end with a hyphen (“-”) Entities are not expanded within a comment
13
©SoftMoore ConsultingSlide 13 Summary of Rules for Well-Formed XML Documents Must begin with XML declaration No unclosed tags (but empty tags are allowed) No overlapping element tags (forces hierarchical tree structure) Root element must contain all other elements Attribute values must be enclosed in quotes Certain textual characters must be represented by entity references (e.g, use “<” for “<“, “&” for “&”, etc.)
14
©SoftMoore ConsultingSlide 14 XML Example John Doe 301-924-1234 12131 Register Road Rockville Maryland 20851 11 12 2005 continued on next slide
15
©SoftMoore ConsultingSlide 15 XML Example (continued) 3 Shirt 39.95... additional LineItem elements 0.05 4.00... additional Order elements
16
©SoftMoore ConsultingSlide 16 XML References Beginning XML (Fifth Edition) by Joe Fawcett, Danny Ayers, and Liam Quin, Wrox/John Wiley & Sons, 2012, ISBN: 978-1118162132. HTML & XHTML (Sixth Edition) by Chuck Musciano and Bill Kennedy, O’Reilly Media, 2006, ISBN: 978-0596527327. Java & XML (Third Edition) by Brett D. McLaughlin and Justin Edelson, O’Reilly Media, 2006, ISBN: 978-0596101497.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.