Presentation is loading. Please wait.

Presentation is loading. Please wait.

Working with XML. Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML.

Similar presentations


Presentation on theme: "Working with XML. Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML."— Presentation transcript:

1 Working with XML

2 Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML = Standard Generalized Markup Language actually a metalanguage…a set of rules for creating markup languages actually a metalanguage…a set of rules for creating markup languages Features of SGML-derived markup languages Features of SGML-derived markup languages Elements (expressed as tags delimited by ) Elements (expressed as tags delimited by ) Attributes – features of the elements Attributes – features of the elements Documents – composed of elements Documents – composed of elements Document type definitions (schema definitions) – provide the meaning for and structure of elements and their attributes Document type definitions (schema definitions) – provide the meaning for and structure of elements and their attributes HTML and XML are both derivations of SGML HTML and XML are both derivations of SGML

3 What is XML? EXtensible Markup Language EXtensible Markup Language A markup language much like HTML A markup language much like HTML More precisely, a markup metalanguage that allows you to create your own markup language. More precisely, a markup metalanguage that allows you to create your own markup language. XML was designed to describe data XML was designed to describe data XML tags are not predefined. You must define your own tags XML tags are not predefined. You must define your own tags XML uses a Document Type Definition (DTD) or an XML Schema to describe the data XML uses a Document Type Definition (DTD) or an XML Schema to describe the data XML with a DTD or XML Schema is designed to be self-descriptive XML with a DTD or XML Schema is designed to be self-descriptive Whereas an XML document contains data, an associated XML Schema contains metadata describing the format and requirements for that data. Whereas an XML document contains data, an associated XML Schema contains metadata describing the format and requirements for that data.

4 XML vs. HTML Purpose of HTML: display information on a browser Purpose of HTML: display information on a browser HTML is a language based on the SGML coding conventions HTML is a language based on the SGML coding conventions Purpose of XML: provide a structure for the description of data Purpose of XML: provide a structure for the description of data XML is a subset of SGML XML is a subset of SGML It is a metalanguage with no preconceived elements or attributes It is a metalanguage with no preconceived elements or attributes You use XML to create your own “language” for describing data by specifying elements and attributes You use XML to create your own “language” for describing data by specifying elements and attributes NOTE: a major purpose of XML is to serve as a standardized protocol for transmitting data between two different applications communicating with each other over the Web NOTE: a major purpose of XML is to serve as a standardized protocol for transmitting data between two different applications communicating with each other over the Web HTML is for B2C, XML is for B2B

5 Features of Markup Languages Document Document Element Element Elements arranged within the document in hierarchical order (tree structure) Elements arranged within the document in hierarchical order (tree structure) Each element has a name (first word in its begin tag) and a value (everything between its begin tag and its end tag) Each element has a name (first word in its begin tag) and a value (everything between its begin tag and its end tag) Syntax: value Syntax: value Attribute Attribute Each element can include attributes (properties) Each element can include attributes (properties) An attribute includes a name and a value An attribute includes a name and a value Syntax:name=value Syntax:name=value

6 Sample XML Document (no attributes) XML representation is hierarchical: a TREE

7 What is a tree? Data structure for representing conceptual or data hierarchies A type of collection Other collections? array, table (2-d array), stack, queue, linked list, hash table (also called dictionary), Characteristics of a Tree Nodes Links (also called branches) Parent-child relationships between nodes Parent can have many children Child has only one parent Path = a route from one node to another in the tree (e.g. from root to a leaf) Traversal in a tree traversal  use RECURSION to implement tree traversal

8

9 Example XML Documents From MS Access From MS Access Data from a table or query in a.XML document Data from a table or query in a.XML document Metadata in a.XSD document (XML Schema) Metadata in a.XSD document (XML Schema) From Amazon Web Services (AWS) From Amazon Web Services (AWS) Result of XML book item search request Result of XML book item search request For Semantic Web For Semantic Web Web Ontology Language (OWL) Web Ontology Language (OWL)

10 XML version of Departments table of Employee database (created by MS Access)

11 XSD (XML Schema Description) defines the metadata of an XML document. XSD is also expressed in XML format. Created by MS Access

12 RSS (Really Simple Syndication) is a common XML format. An RSS feed is composed of channels which contain items.

13 Amazon Web Services (AWS) provides an XML-based communication protocol for interacting with applications over the internet.

14 OWL (XML-based) Web Ontology Language Semantic web may be the next major AI Web 2.0 breakthrough in the internet. Semantic network is a form or knowledge representation.


Download ppt "Working with XML. Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML."

Similar presentations


Ads by Google