Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials.

Similar presentations


Presentation on theme: "Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials."— Presentation transcript:

1 Introduction to XML cs3505

2 References http://www.xmlfiles.com/xml/ –I got most of this presentation from this site http://www.xml.com/ –O’reilly tutorials about XML technology Deitel “Internet&WWW How to Program” –XML chapter 28

3 What is XML? XML stands for EXtensible Markup Language XML tags are not predefined in XML. You must define your own tags. HTML is about displaying data, XML is about describing data. Power is in the extensive tools built around XML not in XML itself Leans toward method for defining data not content. It should have been named EXtensible Markup Method(XMM) XML documents are NOT automatically readable by XML enabled applications.

4 Data Description Problem Data itself Add Context or reference frame Add enough to Make the reference unique Acting upon that information 72 Rule: when you encounter an Nps_ocean:temp display as bold

5 Abstract Information Flow data Reference frame of definitions Input into reference structure Output Action Application Reformat for Specific Applications result Information Processed information

6 XML Information Flow data Document Type Definition Write an XML Document HTML/Jscri pt display XML Parser available in MS IE5 Screen Display Document.XML DOM Model Structure

7 XML Document Syntax Data1 Data2 Data2-1 Data3 The XML declaration should always be included. All XML documents must have a root tag All XML elements must be properly nested XML tags are case sensitive All XML elements must have a closing tag Attribute values must always be quoted

8 XML Attributes XML attributes are normally used to describe XML elements, or to provide additional information about elements. Using an Attribute for sex: Anna Smith Using an Element for sex: female Anna Smith Use of Elements vs. Attributes attributes can not contain multiple values (elements can) attributes are not expandable (for future changes) attributes can not describe structures (like child elements can) attributes are more difficult to manipulate by program code attribute values are not easy to test against a DTD Avoid using attributes Except as an ID

9 Document Type Definition (DTD) XML documents (and HTML documents) are made up by the following building blocks: Elements, Tags, Attributes, Entities, PCDATA, and CDATA Example: Element Document Type Definition (DTD). Note: None = exactly once + = one or more ? = zero or one * = zero or more

10 More DTD declarations DTD example: XML example: Attributes: External Syntax: Internal Syntax: DTD Example: XML example: &writer;&copyright; Entities: define internal or external shortcuts to common text

11 Imbedded vs. External DTD Imbedded External

12 Document Validation of DTD A "Valid" XML document is a "Well Formed" XML document which conforms to the rules of a Document Type Definition (DTD). Essentially like debugging Use IE5 to see if there is an error in your XML document Click on your xml document error No error

13 XML Parser XML Document XML DTD XML Parser Data to application Applic ation XML Parsers build tree structures (I.e.data structure or DOM’s ) from XML documents. Some Parsers Validate the documents and provide error indicators Tree structures can then be referenced by an application program using a DOM address. Example parser.documentElement.childNode[0].text Lots of XML Parsers on the Net - Microsoft has one in IE5

14 XML Display Data Flow XML Document XML DTD XML Parser Microsoft.XML DOM Data Parsed to Document Object Model Read internal represen- tation Jscript Display Data Instruc- tions HTML

15 Simple XML example

16 Microsoft XML Schema XML Schema is an XML based alternative to DTD. An XML schema describes the structure of an XML document and is a Microsoft extension of DTD. XML Schema became an official W3C recommendation in May 2001 and is now stable. The XML Schema language is also referred to as XML Schema Definition (XSD).

17 XML Namespaces Common element (tag) names defined for different uses must be distinguished. This is done with Namespaces uses the unique edi version of the “p” tag NOTE: the URL’s must be of the Form of a URL but are only used as a unique character string

18 Extensible Style Language (XSL) * XSL - defines the layout of a document much like CSS describes the layout of an HTML document * Method of transforming XML documents * Method of formatting XML documents XML document XSL document HTML Template Address references html display

19 XSL example Note name space reference


Download ppt "Introduction to XML cs3505. References –I got most of this presentation from this site –O’reilly tutorials."

Similar presentations


Ads by Google