01 - XML (Part 2).pptx - XML – PART 2 Chapter 7 in...

  • No School
  • AA 1
  • 52

This preview shows page 1 - 11 out of 52 pages.

XML – PART 2 Chapter 7 in textbook: “Programming the World Wide Web” by Robert W. Sebesta “XML Visual Quick Start” by Kevin Howard Goldberg
Image of page 1

Subscribe to view the full document.

XML SCHEMAS Two ways to define a schema: Document Type Definition (DTD) W3C XML Schema (XSD) “PROGRAMMING THE WORLD WIDE WEB” BY SEBESTA, CHAPTER 7. 2
Image of page 2
REMEMBER “VALID” XML Adheres to specification in DTD or XSD. 3
Image of page 3

Subscribe to view the full document.

DTD DEFICIENCIES  DTD ALTERNATIVE: XSD They do not use XML syntax. They do not support namespaces. Data types cannot be strictly specified. Example date vs. string. 4
Image of page 4
XML SCHEMA (XSD) 5
Image of page 5

Subscribe to view the full document.

SCHEMA FUNDAMENTALS XML documents that conform to a schema’s rules are considered instances of that schema. Three purposes of an XML schema: Specify the elements and attributes of an XML language. Specify the structure of its instance XML documents. Specify the data type of every element and attribute of its instance XML documents. “PROGRAMMING THE WORLD WIDE WEB” BY SEBESTA, CHAPTER 7. 6
Image of page 6
DEFINING A SCHEMA The XML Schema language itself is a set of XML tags. Schema of schemas. Its namespace: . Every XML schema has a single root, schema The schema element must specify the namespace for schemas as its xmlns:xsd attribute. The application being described is another set of tags. Every XML schema itself defines a tag set, which must be named: targetNamespace = http :// cs.uccs.edu/planeSchema Includes the names of every top-level element. “PROGRAMMING THE WORLD WIDE WEB” BY SEBESTA, CHAPTER 7. 7
Image of page 7

Subscribe to view the full document.

DEFINING A SCHEMA (CONTINUED) If we want to include nested elements, we must set the elementFormDefault attribute to qualified . The default namespace must also be specified: xmlns = "" “PROGRAMMING THE WORLD WIDE WEB” BY SEBESTA, CHAPTER 7. 8
Image of page 8
A COMPLETE EXAMPLE OF A schema ELEMENT OPENING TAG <xsd:schema <!-- Namespace for the schema itself --> xmlns:xsd = "" <!-- Namespace where elements defined here will be placed --> targetNamespace = "" <!-- Default namespace for this document --> xmlns = "" <!-- Next, specify non-top-level elements to be in the target namespace --> elementFormDefault = "qualified"> “PROGRAMMING THE WORLD WIDE WEB” BY SEBESTA, CHAPTER 7. 9
Image of page 9

Subscribe to view the full document.

A COMPLETE EXAMPLE OF A schema ELEMENT OPENING TAG – AN ALTERNATIVE <schema <!-- Namespace for the schema itself + Make it the default --> xmlns = "" <!-- Namespace where elements defined here will be placed --> targetNamespace = "" <!– Now, names in target namespace need to be prefixed --> xmlns:plane = "" <!-- Next, specify non-top-level elements to be in the target namespace --> elementFormDefault = "qualified"> “PROGRAMMING THE WORLD WIDE WEB” BY SEBESTA, CHAPTER 7.
Image of page 10
Image of page 11
  • Fall '19
  •  Document Type Definition

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes