XML Introduction - University of California, Riverside

XML Introduction - University of California, Riverside

XML INTRODUCTION Prepared by Hongming Yu Modified by Fernando Farfn Index 2 Markup Language: SGML, HTML, XML An XML example Why is XML important XML introduction XML applications XML support XML Introduction Markup Language 3 A markup language must specify

What markup is allowed What markup is required How markup is to be distinguished from text What the markup means *XML only specify the first three, the fourth is specified by DTD XML Introduction SGML (ISO 8879) 4 Standard Generalized Markup Language The international standard for defining descriptions of structure and content in text documents Interchangeable: device-independent, system-independent tags are not predefined Using DTD to validate the structure of the document

Large, powerful, and very complex Heavily used in industrial and commercial for over a decade XML Introduction HTML (RFC 1866) 5 HyperText Markup Language A small SGML application used on web (a DTD and a set of processing conventions) Can only use a predefined set of tags XML Introduction What is XML? 6

eXtensible Markup Language A simplified version of SGML Maintains the most useful parts of SGML Designed so that SGML can be delivered over the Web More flexible and adaptable than HTML XHTML A reformulation of HTML 4 in XML Introduction Difference Between XML and HTML 7

XML was designed to carry data, not displaying data XML is not a replacement for HTML. Different goals: XML was designed to describe data and to focus on what data is. HTML was designed to display data and to focus on how data looks. HTML is about displaying information, XML is about describing information. XML Introduction An Example of XML 8

Tove Jani Reminder Don't forget me this weekend! XML Introduction Why is XML Important? 9 Plain Text

Easy to edit Useful for storing small amounts of data Possible to efficiently store large amounts of XML data through an XML front end to a database Data Identification Tell you what kind of data you have Can be used in different ways by different applications XML Introduction Why is XML Important? 10

Stylability Inherently style-free XSL---Extensible Stylesheet Language Different XSL formats can then be used to display the same data in different ways Inline Reusabiliy Can be composed from separate entities Modularize your documents without resorting to links XML Introduction

Why is XML important? 11 Linkability -- XLink and XPointer Simple unidirectional hyperlinks Two-way links Multiple-target links Expanding links Easily Processed

Regular and consistent notation Vendor-neutral standard XML Introduction Why is XML important? 12 Hierarchical Faster to access Easier to rearrange XML Introduction

XML Specifications 13 XML 1.0: Defines the syntax of XML XPointer, XLink, XInclude: Defines a standard way to represent links between resources XSL: Defines the standard stylesheet language for XML XML Introduction XML Building Blocks

14 Elements Delimited by angle brackets Identify the nature of the content they surround General format: Empty element: Attributes

Name-value pairs that occur inside starttags after element name, like: XML Introduction XML Building Blocks: Prolog 15 The part of an XML document that precedes the XML data Includes A declaration: version [, encoding,

standalone] An optional DTD (Document Type Definition ) Example XML Introduction XML Syntax 16 All XML elements must have a closing tag XML tags are case sensitive All XML elements must be properly nested All XML documents must have a root tag Attribute values must always be quoted With XML, white space is preserved With XML, a new line is always stored as LF Comments in XML:

XML Introduction XML Elements 17 XML Elements are Extensible XML documents can be extended to carry more information XML Elements have Relationships Elements are related as parents and children Elements have Content Elements can have different content types: element content, mixed content, simple content, or empty content

and attributes XML elements must follow the naming rules XML Introduction XML Attributes 18 Located in the start tag of elements Provide additional information about elements Often provide information that is not a part of data Must be enclosed in quotes Should I use an element or an attribute? metadata (data about data) should be stored as

XML Introduction attributes, and that data itself should be stored XML Validation 19 "Well Formed" XML document -- Correct XML syntax "Valid" XML document XML DTD

Well formed Conforms to the rules of a DTD (Document Type Definition) defines the legal building blocks of an XML document Can be inline in XML or as an external reference XML Schema an XML based alternative to DTD, more powerful Support namespace and data types XML Introduction Displaying XML 20

XML documents do not carry information about how to display the data We can add display information to XML with CSS (Cascading Style Sheets) XSL (eXtensible Stylesheet Language) --preferred XML Introduction XML Application 1: Separate Data 21 XML can Separate Data from HTML

Store data in separate XML files Using HTML for layout and display Using Data Islands Data Islands can be bound to HTML elements Benefits: Changes in the underlying data will not require any changes to your HTML XML Introduction XML Application 2:

Exchange Data 22 XML is used to Exchange Data Text format Software-independent, hardware-independent Exchange data between incompatible systems, given that they agree on the same tag definition. Can be read by many different types of applications

Benefits: Reduce the complexity of interpreting data Easier to expand and upgrade a system XML Introduction XML Application 3: Store Data 23 XML can be used to Store Data

Plain text file Store data in files or databases Application can be written to store and retrieve information from the store Other clients and applications can access your XML files as data sources Benefits: Accessible to more applications XML Introduction 24 XML Application 4: Create a New Language

XML can be used to Create new Languages SVG (Scalable Vector Graphic): Used to represent vector figures and graphics. CDA (Clinical Document Architecture): Used to represent Electronic Health Records. WML (Wireless Markup Language): used to markup Internet applications for handheld devices like mobile phones (WAP). MusicXML: Used to publishing musical scores. XML Introduction

Java APIs for XML 25 JAXP: Java API for XML Processing JAXB: Java Architecture for XML Binding JDOM: Java DOM DOM4J: an alternative to JDOM JAXM: Java API for XML Messaging (asynchronous) JAX-RPC: Java API for XML-based Remote Process Communications (synchronous) JAXR: Java API for XML Registries XML Introduction Conclusions 26 XML is a self-descriptive language. XML is a powerful language to

describe structured data for web application. XML is currently applied in many fields. Many vendors already supports or will support XML. XML Introduction References 27 Working with XML: The Java(TM)/XML Tutorial http://java.sun.com/xml/

XML tutorial http://www.w3schools.com/w3c/ A technical introduction to XML http://www.xml.com/pub/a/98/10/guide0.h tml XML Introduction

Recently Viewed Presentations

  • School Direct - HVL

    School Direct - HVL

    Nick Gibb states that HEIs involved in ITE pose a substantial threat to the effective development of teachers and the teaching profession in the UK. ... School Direct: ideology and impact ... V., McNicholl, J. & Pendry, A. (2012) 'Institutional...
  • Section 508 Unified Approach Unified compliance testing across

    Section 508 Unified Approach Unified compliance testing across

    Pilot: Unified Testing Accessibility Project (UTAP) Purpose: DHS helped 4 agencies adopt the TT. Agencies were classified as S, M, L, and XL . MOUs between DHS and agencies. Organizational assessments conducted. Assisted agency staff in designing their . own...
  • The Battles of King's Mountain and Cowpens

    The Battles of King's Mountain and Cowpens

    Patriot ForcesBattle of King's Mountain. Col. Benjamin Cleveland, 980 men (NC) Col. William Campbell, 430 men (VA, SC, and GA) Total: 1,410. NOTE 1: Only . 900 of this total actually fought in the Battle of Kings Mountain.
  • Is Teaching An Art, Science, or Craft - University of Idaho

    Is Teaching An Art, Science, or Craft - University of Idaho

    Is Teaching An Art, Science, or Craft Art Be very creative Relational between students - feeling and empathetic Teaching is expressive - impulsive Teaching is intuitive Teaching is a very social activity Motivation Sublime and unexplainable Not routine or formulaic...
  • Systems Engineering for Reversible Quantum Nanocomputers Dr ...

    Systems Engineering for Reversible Quantum Nanocomputers Dr ...

    E.g., with an Ron/off of 109, you can do worst-case computation in an adiabatic circuit with: An energy savings of up to a factor of 1,200× ! But, this point is 700,000× less hardware-efficient!
  • Serving adult learners in California Community Colleges: 8.5

    Serving adult learners in California Community Colleges: 8.5

    Adult Promise grant: Landscape analysis with central question: What programs and services are currently serving this population? Student focus groups with central questions: What has been your experience with these programs and services? How can we better communicate about the...
  • Informed Consent for Major Gynaecologic Oncology Surgery XXVIII

    Informed Consent for Major Gynaecologic Oncology Surgery XXVIII

    Sidaway. v Governors of . Bethlem. Royal Hospital [1985] AC 871 at 881 (per Lord Scarman). See also . Bolam. v . Friern. Hospital Management Committee [1957] I WLR 582. Presentation to XXVIII ASGO Scientific Meeting by Prof L McCrimmon...
  • Chem. 31 - 9/15 Lecture

    Chem. 31 - 9/15 Lecture

    Lab Report for Lab #1 due Monday/Tuesday. Second Mastering Set due Tuesday (should cover material to do most problems today) Exam #1. Two weeks from today (9/29) ... What is the pH of a raindrop if [H. 2 CO 3]...