Oracle9i Case Studies - XML Applications
Release 1 (9.0.1)

Part Number A88895-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

A
An XML Primer

This Appendix contains the following sections:

What is XML?

XML, eXtensible Markup Language, is the standard way to identify and describe data on the web. It is widely implementable and easy to deploy.

XML is a human-readable, machine-understandable, general syntax for describing hierarchical data, applicable to a wide range of applications, databases, e-commerce, Java, web development, searching, and so on.

Custom tags enable the definition, transmission, validation, and interpretation of data between applications and between organizations.

W3C XML Recommendations

The World Wide Web Consortium (W3C) XML recommendations are an ever-growing set of interlocking specifications.

The XML family of applications is illustrated in Figure A-1.

Figure A-1 The XML Family of Applications ('Including XML-Based Standards')


Text description of adxml007.gif follows
Text description of the illustration adxml007.gif

XML Features

The following bullets describe XML features:

Although this manual is not intended to expound on XML syntax, a brief overview of some key XML topics is presented here. You can refer to the many excellent resources listed in "Additional XML Resources" for more information on XML syntax.

How XML Differs From HTML

Like HTML, XML is a subset of SGML (Structured Generalized Markup Language), optimized for delivery over the web.

Unlike HTML, which tags elements in web pages for presentation by a browser, e.g. <bold>Oracle</bold>, XML tags elements as data, e.g. <company>Oracle</company>. For example, you can use XML to give context to words and values in web pages, identifying them as data instead of simple textual or numeric elements.

The following example is in HTML code. This is followed by the corresponding XML example. The examples show employee data:

HTML Example 1

<table>
   <tr><td>EMPNO</td><td>ENAME</td><td>JOB</td><td>SAL</td></tr>
   <tr><td>7654</td><td>MARTIN</td><td>SALESMAN</td><td>1250</td></tr>
   <tr><td>7788</td><td>SCOTT</td><td>ANALYST</td><td>3000</td></tr>
 </table>

XML Example 1

In the XML code, note the addition of XML data tags and the nested structure of the elements.

<?xml version="1.0"?>
  <EMPLIST>
    <EMP>
    <EMPNO>7654</EMPNO>
    <ENAME>MARTIN</ENAME>
     <JOB>SALESMAN</JOB>
     <SAL>1250</SAL>
    </EMP>
    <EMP>
    <EMPNO>7788</EMPNO>
    <ENAME>SCOTT</ENAME>
    <JOB>ANALYST</JOB>
    <SAL>3000</SAL>
    </EMP>
  </EMPLIST>

HTML Example 2

Consider the following HTML that uses tags to present data in a row of a table. Is "Java Programming" the name of a book? A university course? A job skill? You cannot be sure by looking at the data and tags on the page. Imagine a computer program trying to figure this out!

<HTML>
  <BODY>
    <TABLE>
     <TR>
     <TD>Java Programming</TD>
     <TD>EECS</TD>
     <TD>Paul Thompson</TD>
     <TD>Ron<BR>Uma<BR>Lindsay</TD>
     </TR>
    </TABLE>
  </BODY>
 </HTML>

The analogous XML example has the same data, but the tags indicate what information the data represents, not how it should be displayed. It's clear that "Java Programming" is the Name of a Course, but it says nothing about how it should be displayed.

XML Example 2

<?xml version="1.0"?>
  <Course>
      <Name>Java Programming</Name>
    <Department>EECS</Department>
    <Teacher>
      <Name>Paul Thompson</Name>
    </Teacher>
    <Student>
      <Name>Ron</Name>
    </Student>
    <Student>
      <Name>Uma</Name>
    </Student>
    <Student>
      <Name>Lindsay</Name>
    </Student>
  </Course>

XML and HTML both represent information:

Summary of Differences Between XML and HTML

Figure 9-1 summarizes, how XML differs from HTML.

Table 9-1 XML and HTML Differences
XML  HTML 

Represents information content 

Represents the presentation of the content 

Has user-defined tags 

Has a fixed set of tags defined by standards. 

All start tags must have end tags 

Current browsers relax this requirement on tags <P>, <B>, and so on. 

Attributes must be single or double quoted 

Current browsers relax this requirement on tags  

Empty elements are clearly indicated 

Current browsers relax this requirement on tags  

Element names and attributes are case sensitive 

Element names and attributes are not case sensitive. 

Presenting XML Using Stylesheets

A key advantage of using XML as a datasource is that its presentation (such as a web page) can be separate from its structure and content.

Stylesheet Uses

Consider these ways of using stylesheets:

Stylesheets can be applied on the server or client side. The XSL-Transformation Processor (XSL-T Processor) transforms one XML format into XML or any other text-based format such as HTML. Oracle XML Parsers all include an XSL-T Processor.

How to apply stylesheets and use the XSL-T Processor is described in the following sections in Oracle9i Application Developer's Guide - XML:

In this manual, see Chapter 7, "Customizing Discoverer 4i Viewer with XSL".

eXtensible Stylesheet Language (XSL)

eXtensible Stylesheet Language (XSL), the stylesheet language of XML is another W3C recommendation. XSL provides for stylesheets that allow you to do the following:

Cascading Style Sheets (CSS)

Cascading Style Sheets (CSS1), a W3C specification was originally created for use with HTML documents. With CSS you can control the following aspects of your document's appearance:

CSS2 was published by W3C in 1998 and includes the following additional features:

'Cascading' here implies that you can apply several stylesheets to any one document. On a web page deploying CSS, for example, three stylesheets can apply or cascade:

  1. User's preferred stylesheet takes precedence

  2. Cascading stylesheet

  3. Browser stylesheet

    See Also:

    Oracle9i Application Developer's Guide - XML, "Using XSL and XSLT" 

Extensibility and Document Type Definitions (DTD)

Another key advantage of XML over HTML is that it leaves the specification of the tags and how they can be used to the user. You construct an XML document by creating your own tags to represent the meaning and structure of your data.

Tags may be defined by using them in an XML document or they may be formally defined in a Document Type Definition (DTD). As your data or application requirements change, you can change or add tags to reflect new data contexts or extend existing ones.

The following is a simple DTD for the previous XML example:

  <!ELEMENT EMPLIST (EMP)*>
  <!ELEMENT EMP (EMPNO, ENAME, JOB, SAL)>
  <!ELEMENT EMPNO (#PCDATA)>
  <!ELEMENT ENAME (#PCDATA)>
  <!ELEMENT JOB (#PCDATA)>
  <!ELEMENT SAL (#PCDATA)>


Note:

The DOCTYPE declaration is only used when the DTD is embedded in XML code. 


Well-Formed and Valid XML Documents

Well-Formed XML Documents

An XML document that conforms to the structural and notational rules of XML is considered well-formed. A well-formed XML document does not have to contain or reference a DTD, but rather can implicitly define its data elements and their relationships. Well-formed XML documents must follow these rules:

Valid XML Documents

Well-formed XML documents that also conform to a DTD are considered valid. When an XML document containing or referencing a DTD is parsed, the parsing application can verify that the XML conforms to the DTD and is therefore valid, which allows the parsing application to process it with the assurance that all data elements and their content follow rules defined in the DTD.

Why Use XML?

XML, the internet standard for information exchange is useful for the following reasons:

Other Advantages of Using XML

Other advantages of using XML include the following:

Additional XML Resources

Here are some additional resources for information about XML:


Go to previous page Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback