Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML CSC1310 Fall 2009. HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December 1990.  Markup  Markup is a symbol.

Similar presentations


Presentation on theme: "XML CSC1310 Fall 2009. HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December 1990.  Markup  Markup is a symbol."— Presentation transcript:

1 XML CSC1310 Fall 2009

2 HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December 1990.  Markup  Markup is a symbol embedded into text ( ) to enhance the meaning of the information in certain ways, identifying parts and to know how they relate to each other. Hello HTML Hello World!

3 HTML DRAWBACKS  HTML isn't extensible  There is no user-defined tag (browser makers, W3C (World Wide Web Consortium)).  HTML is very display-centric  HTML is a mixture of document logical structure (titles, paragraphs) with presentation tags (bold, image alignment). HTML is useless for data replication or application services.  HTML isn't usually directly reusable  The entire translation needs to be redone if any change.  HTML only provides one 'view' of data  Dynamic HTML requires a huge amount of scripting.  HTML has little or no semantic structure  Web applications need to represent data by meaning rather than by layout. HTML has no way to specify what a particular page item means.

4 XML (JON BOSAK, MARCH 1997) EXtensible Markup Language  XML stands for EXtensible Markup Language carry data  XML was designed to carry data, not to display data.  XML tags are not predefined. You must define your own tags.  XML is not a replacement for HTML:  HTMLdisplaying  HTML is about displaying information, XMLcarrying  while XML is about carrying information.

5 XML DOES NOT DO ANYTHING  XML is just plain text. XML-aware applications can handle the XML tags specially to structure, store, and transport information.

6 XML USAGE  XML data is stored in plain text format.  XML is a cross-platform, software and hardware independent tool for transmitting information.  Data can be exchanged between incompatible systems.  Data become available to more applications.  XML simplifies platform changes.  XML separates data from HTML: with a few lines of JavaScript, you can read an external XML file and update the data content of your HTML.  XML is going to be the main language for exchanging financial information between businesses over the Internet.

7 XML SYNTAX the XML declaration  The first line in the document - the XML declaration - defines the XML version and the character encoding used in the document.  Optional.

8 XML SYNTAX root  The second line describes the root element of the document ("this document is a(?) note")

9 XML SYNTAX child rootto, from, heading, and body  The next 4 lines describe four child elements of the root (to, from, heading, and body)

10 TREE STRUCTURE root element  XML documents must contain a root element, "the parent" of all other elements.  The elements in an XML document form a document tree which starts at the root and branches to the lowest level of the tree.  All elements can have sub elements, text contents and attributes. siblings  Children on the same level are called siblings

11 EXAMPLE

12 ELEMENT VS ATTRIBUTE  There are no rules about when to use attributes and when to use elements. cannotIn contrast to elements, attributes cannot: –contain multiple values –contain tree structures – be easily expandable. elementsdataUse elements for data. attributes metadataUse attributes for metadata (data about data).

13 ALL XML ELEMENTS MUST HAVE A CLOSING TAG  With XML, it is illegal to omit the closing tag except a tag for empty element.  In HTML: This is a paragraph. This is another paragraph  In XML: This is another paragraph  Empty element references information that should be used rather than contains it.

14 XML TAGS ARE CASE SENSITIVE  Unlike HTML, XML tags are case sensitive. This is incorrect This is correct

15 XML ELEMENTS MUST BE PROPERLY NESTED  Improper nesting of tags makes no sense to XML.  In HTML some elements can be improperly nested within each other like this: This text is bold and italic  In XML all elements must be properly nested within each other like this: This text is bold and italic

16 XML ATTRIBUTE VALUES MUST BE QUOTED

17 ENTITY REFERENCES if salary entity referenceReplace the "<" character with an entity reference: &lt if salary < 1000 then There are 5 predefined entity references in XML <&Only the characters "<" and "&" are strictly illegal in XML.

18 NAMING RULES Names can contain letters, numbers, and other characters. Names must not start with a number, or punctuation character. Names cannot contain spaces (use underscore). Any name can be used, no words are reserved. Make names descriptive. Names should be short and simple. Avoid – "-“ : software may think it is subtraction. –"." : software may think that it is property. –":" : colons are reserved for namespaces.

19 WELL FORMED XML DOCS well formedA well formed XML doc follows XML syntax: –XML documents must have a root element –XML elements must have a closing tag –XML tags are case sensitive –XML elements must be properly nested –XML attribute values must be quoted Result: compatibility. document modelSome program may perform complex operations on highly specific data and need to concretize markup language (document model)

20 DOCUMENT TYPE DEFINITIONS (DTDS) structureDTD defines the structure of an XML document. declarations legal elementsIt is a collection of rules (declarations) describing the list of legal elements and other markup objects. DTD does not restrict what kind of data go inside elements. PCDATA is text that will be parsed by a parser for entities and markup (CDATA). http://www.w3schools.com/dtd/default.asp

21 XML SCHEMA Schema is alternative way to specify patterns for data. Schema is more powerful than DTDs Schema supports data types http://www.w3schools.com/schema/schema_intro.asp


Download ppt "XML CSC1310 Fall 2009. HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December 1990.  Markup  Markup is a symbol."

Similar presentations


Ads by Google