Chapter 16: Introduction to XML and DTD Files

Similar documents
Chapter 13 XML: Extensible Markup Language

XML. extensible Markup Language. Overview. Overview. Overview XML Components Document Type Definition (DTD) Attributes and Tags An XML schema

Introduction to XML Zdeněk Žabokrtský, Rudolf Rosa

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 27-1

UNIT I. A protocol is a precise set of rules defining how components communicate, the format of addresses, how data is split into packets

The concept of DTD. DTD(Document Type Definition) Why we need DTD

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 7 XML

Overview. Introduction. Introduction XML XML. Lecture 16 Introduction to XML. Boriana Koleva Room: C54

extensible Markup Language

Introduction Syntax and Usage XML Databases Java Tutorial XML. November 5, 2008 XML

7.1 Introduction. extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML

EMERGING TECHNOLOGIES. XML Documents and Schemas for XML documents

Part II: Semistructured Data

.. Cal Poly CPE/CSC 366: Database Modeling, Design and Implementation Alexander Dekhtyar..

Data Presentation and Markup Languages

Schema Document Has Different Target Namespace From The One Specified In Instance Document

Outline. XML vs. HTML and Well Formed vs. Valid. XML Overview. CSC309 Tutorial --XML 4. Edward Xia


CSS, Cascading Style Sheets

RepCom: A Customisable Report Generator Component System using XML-driven, Component-based Development Approach

A new generation of tools for SGML

Zend Studio 3.0. Quick Start Guide

XML DTD A brief introduction. Glossary XML DTD <!DOCTYPE [ ]>

Well-formed XML Documents

Relational Data Model is quite rigid. powerful, but rigid.

XML. extensible Markup Language. ... and its usefulness for linguists

Electronic Commerce Architecture Project LAB ONE: Introduction to XML

1. Please, please, please look at the style sheets job aid that I sent to you some time ago in conjunction with this document.

Semistructured Data and XML

A tutorial report for SENG Agent Based Software Engineering. Course Instructor: Dr. Behrouz H. Far. XML Tutorial.

Dreamweaver CS6. Level 1. Topics Workspaces Basic HTML Basic CSS

Using UML To Define XML Document Types

XML. Objectives. Duration. Audience. Pre-Requisites

Fundamentals of Web Programming a

Chapter 1: Getting Started. You will learn:

Tutorial 2: Validating Documents with DTDs

Introduction to XML. Chapter 133

The Semi-Structured Data Model. csc343, Introduction to Databases Diane Horton originally based on slides by Jeff Ullman Fall 2017

No Grammar Constraints (dtd Or Xml Schema) Referenced In The Document. Build.xml

Overview. Structured Data. The Structure of Data. Semi-Structured Data Introduction to XML Querying XML Documents. CMPUT 391: XML and Querying XML

SDPL : XML Basics 2. SDPL : XML Basics 1. SDPL : XML Basics 4. SDPL : XML Basics 3. SDPL : XML Basics 5

Introduction to Semistructured Data and XML. Contents

Information Systems. DTD and XML Schema. Nikolaj Popov

World-Wide Wide Web. Netprog HTTP

CHAPTER 1: GETTING STARTED WITH HTML CREATED BY L. ASMA RIKLI (ADAPTED FROM HTML, CSS, AND DYNAMIC HTML BY CAREY)

5/19/2015. Objectives. JavaScript, Sixth Edition. Introduction to the World Wide Web (cont d.) Introduction to the World Wide Web

An Introduction to GenCAM/GenX. Handout 4c

The World Wide Web is a technology beast. If you have read this book s

Semistructured data, XML, DTDs

Outline. XML DOCTYPE External - SYSTEM. XML DOCTYPE Internal DTD &6&7XWRULDO ;0/ (GZDUG;LD

Replication Monitor User s Guide

Tutorial 10: Programming with JavaScript

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0

MDSML: An XML Binding to the Grid Object Specification

Lunch n Learn Unders Under t s a t nding nding D D T s UNCLASSIFIED

HTML. Mohammed Alhessi M.Sc. Geomatics Engineering. Internet GIS Technologies كلية اآلداب - قسم الجغرافيا نظم المعلومات الجغرافية

Web Scraping with Python

Fundamentals of Web Programming a

FOSI. Tutorials. Quickstart. for Arbortext Editor. Part 1: Formatting for Screen and Print FOSIs. Suzanne Napoleon

CSI 3140 WWW Structures, Techniques and Standards. Markup Languages: XHTML 1.0

Review of HTML. Chapter Pearson. Fundamentals of Web Development. Randy Connolly and Ricardo Hoar

XML. Document Type Definitions XML Schema. Database Systems and Concepts, CSCI 3030U, UOIT, Course Instructor: Jarek Szlichta

Week 2: Lecture Notes. DTDs and XML Schemas

This chapter describes the encoding scheme supported through the Java API.

Delivery Options: Attend face-to-face in the classroom or remote-live attendance.

XML module 2. Creating XML. Hans C. Arents. senior IT market analyst. I.T. Works. Guiding the IT Professional

XML for Java Developers G Session 2 - Sub-Topic 1 Beginning XML. Dr. Jean-Claude Franchitti

Tutorial 1 Getting Started with HTML5. HTML, CSS, and Dynamic HTML 5 TH EDITION

Chapter 7: XML Namespaces

Grid Computing. What is XML. Tags, elements, and attributes. Valid and well formed XML. Grid Computing Fall 2006 Paul A.

Background of HTML and the Internet

The Heterogeneous Collection Track at INEX 2006

Expressing Internationalization and Localization information in XML

Introduction to XML (Extensible Markup Language)

Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013

XML: Extensible Markup Language

XML, DTD, and XPath. Announcements. From HTML to XML (extensible Markup Language) CPS 116 Introduction to Database Systems. Midterm has been graded

XML Technologies XML, DTD

Introduction to XML. XML: basic elements

Semantic Analysis. Compiler Architecture

Chapter 10: Understanding the Standards

Automated Classification. Lars Marius Garshol Topic Maps

Eclipse Generate Xml From Xsd No Root Element

XML and DTD. Mario Alviano A.Y. 2017/2018. University of Calabria, Italy 1 / 28

The Xlint Project * 1 Motivation. 2 XML Parsing Techniques

CPT374 Tutorial-Laboratory Sheet Two

Part 2: XML and Data Management Chapter 6: Overview of XML

Introduction to Database Systems CSE 414

SOAP, WSDL, HTTP, XML, XSD, DTD, UDDI - what the?

MadCap Software. Index Guide. Flare 2017 r2

Infor LN Studio Application Development Guide

Chapter 13: Introduction to XML. Informatics Practices Class XII. By- Deepak Bhinde

Constructing a Document Type Definition (DTD) for XML

CLASS DISCUSSION AND NOTES

SXML: Streaming XML. Boris Rogge 1, Dimitri Van De Ville 1, Rik Van de Walle 1, Wilfried Philips 2 and Ignace Lemahieu 1

DITA Keys Analyzer User Guide. Copyright Maxprograms

CSC Web Technologies, Spring Web Data Exchange Formats

JavaScript Functions, Objects and Array

XML: Parsing and Writing

Design issues in XML formats

Transcription:

Chapter 16: Introduction to XML and DTD Files The configuration files for the CRL desktop as well as for the inquiry and forms features are provided in XML format. In this chapter we provide the information you need in order to understand CRL s XML configuration files. This chapter is not intended as a general XML reference. 16.1 XML Compared to HTML XML is most easily described by starting with HTML. HTML markup consists of tags that define text structures, formatting, and so on, for documents (e.g., <H1>... </H1> for top level header), and attributes that set properties for those tags (e.g., <H1 ALIGN="CENTER">). HTML is limited to documentation. It is not case-sensitive. XML is a configurable, extensible language with syntax similar to HTML. XML is case-sensitive. XML can be used for documentation, but it is more versatile than just that. In particular, the CRL code, written in Java, is designed to read in a configuration file supplied in XML format. Elements in XML are analogous to tags in HTML; they represent structures or desired behavior. Attributes define properties of elements. Elements are used with attributes in XML the same way as tags are in HTML: <ELEMENT ATTRIBUTE="value">data</ELEMENT> The configuration files for CRL are provided in valid XML (as opposed to well formed XML) 1. A file written in valid XML is based upon a document type definition (DTD) file. As of V1_7_06 the DTD is embedded in the XML files. When you install CRL, the following XML files for CRL itself and for its inquiry feature (described in section 8.2 Inquiries) are stored under the LogBook_admin directory: LogBookConfig.xml LogBookInquiryConfig.xml 1. There are many references on the Web which discuss valid and well formed XML. In writing this section, the author referenced http://pdbeam.uwaterloo.ca/~rlander/xml_tutorial/. Introduction to XML and DTD Files 16-1

The XML files (with embedded DTDs) for forms 1 are located under a separate directory, set by the Logbook.file_location.forms_directory in the properties file. The DTD file defines the element types and the attribute lists that can be used in the corresponding XML file as elements and attributes, respectively, in markup declarations. In order to edit an XML configuration file effectively, you need to understand both it and the DTD so that you know what elements/attributes you re allowed to include, and what they mean. The DTD and the CRL code have been developed in an integrated fashion and are highly dependent upon each other. Do not edit the DTD portion of the files! It will cause CRL to malfunction or become inoperable! The XML configuration files can be edited at will as long as the changes conform to the DTDs, and as long as information corresponding to hard-coded items/functions in the CRL code are not changed. Use a good XML authoring tool rather than a straight text editor in order to ensure that your edits are valid. 16.2 Let s Get a Feel For It... As we said, XML can be thought of as HTML with user-configurable elements and attributes. So, before we get too deep, here s a sample scenario intended to give you a feel for how these entities are defined and used. In the DTD file, we have the following element type declaration for EntryInputPage, which corresponds to a page on the CRL desktop. <!ELEMENT EntryInputPage (Keyword?,Menu+,ToolBar?)> <!ATTLIST EntryInputPage class CDATA #REQUIRED title CDATA #REQUIRED tooltip CDATA #REQUIRED> Don t worry about all the syntactic details yet, just notice that it defines EntryInputPage, that Keyword, Menu and Toolbar appear in the declaration (it turns out they are also element types, defined in the same DTD), and that EntryInputPage has a list of attributes (class, title and tooltip). 1. The forms definition files are not written in "valid XML"; they do not strictly follow a DTD file grammar. 16-2 Introduction to XML and DTD Files

In the XML configuration file, this EntryInputPage element type can be used to define a page on the desktop that allows data entry. The EntryInputPage element shown below (taken from the default CRL configuration file and edited for brevity) includes the listed attributes. It also includes Keyword, Menu and Toolbar elements. <EntryInputPage class="logbook.page_entryinput" title="tutorial" tooltip="tutorial"> <Keyword type="page"> Tutorial, </Keyword> <Menu name="tutorial" > <Topic class="logbook.myinternaltopicframe" name="general Log" double-click="logbook.logentry.logentrytext" size="90%,90%" offset="5%,5%" command="add_to_menu_page"> <Keyword type="category"> General_Log </Keyword> </Topic>... <ToolBar> <ToolButton class="logbook.logentry.logentryimage" tip="drag and Drop MiniBooNE Detector Button to Selected Container" image="images/entryinputpages/boone.gif" parm1="http://www-boone.fnal.gov/images/illustration.gif" command1="" /> <ToolButton class="logbook.logentry.logentrytext" tip="drag and Drop Text Button to Selected Container" image="images/entryinputpages/text.gif" command1="" />... </ToolBar> </EntryInputPage> 16.3 Element Types and Attributes in the DTD File 16.3.1 Element Type Declarations In CRL, elements typically define items on the desktop, e.g., a desktop page, a menu, a toolbar, and so on. Each element type is defined in the (embedded) DTD file in the following form: <!ELEMENT NAME (CONTENT1-plus-OPERATOR,CONTENT2-plus-OPERATOR)> In the CRL DTD file, the content area consists of either a sequence of other element types (these element types must also be defined in the DTD file), or the string #PCDATA, which indicates text. An operator (as in CONTENT-plus-OPERATOR) indicates whether the content is optional or required, and repeatable or not. The operators used in the CRL DTD file include: Introduction to XML and DTD Files 16-3

* optional and repeatable? optional, not repeatable + required and repeatable no operator required, not repeatable Multiple content elements are separated by a comma and must be used in the order listed. Here is an example element type declaration from the CRL DTD file: <!ELEMENT EntryInputPage (Keyword?,Menu+,ToolBar?)> This tells us that when used in the XML file, the element type Page can include the three element types Keyword, Menu and Toolbar as content (see example below). The operator symbols with them indicate that the element Page: can include one and only one occurrence of the element Keyword; if included, it must come before any occurrences of Menu must include at least one occurrence of Menu can include one and only one occurrence of the element Toolbar; if included, it must come after occurrences of Menu Every element in the XML configuration file must be specifically closed at the end. E.g., every <ElementName> has a corresponding </ElementName>. If an element has no subelements, it may be constructed as <ElementName... />, where the slash-angle bracket (/>) closes it. 16.3.2 Attributes and Attribute Lists Each element type in the DTD file may have an associated attribute list defined. This list determines set of possible attributes that element can take in the XML file. In CRL, attributes typically define titles, roll-over text, file locations, and so on, and it is straightforward to assign values to them. A few attributes are more exacting; for example, values for the class attribute are restricted to those in the CRL class library, listed in section 17.3 The CRL Java Class Libraries. The CRL DTD file includes only CDATA type attributes 1. This type of attribute is also called a string attribute since in XML markup it takes a text string as a value. A CDATA attribute list takes the form: <!ATTLIST ELEMENT-TYPE ATTRIBUTE1 CDATA DEFAULT ATTRIBUTE2 CDATA DEFAULT...> 1. There are several different kinds of attributes; defining them is beyond the scope of this document. 16-4 Introduction to XML and DTD Files

where (in the CRL DTD file) the DEFAULT value is one of the following: #REQUIRED (required) #IMPLIED (optional) 16.3.3 Example of Element Type Declaration plus Attribute List Here is an example from the CRL DTD file of a declaration for the element type EntryInputPage followed by its corresponding attribute list: <!ELEMENT EntryInputPage (Keyword?,Menu+,Toolbar?)> <!ATTLIST EntryInputPage class CDATA #REQUIRED title CDATA #REQUIRED tooltip CDATA #REQUIRED> This tells us that in the XML file, whenever the element EntryInputPage is used, it must provide values for all three listed attributes, e.g.,: <EntryInputPage class="logbook.page_entryinput" title="tutorial" tooltip="tutorial">... </EntryInputPage> What these particular attributes do is discussed in Chapter 17: The CRL Desktop Configuration File. Introduction to XML and DTD Files 16-5

16-6 Introduction to XML and DTD Files