Presentation is loading. Please wait.

Presentation is loading. Please wait.

Markup Languages & XML - BY VISHAL KAMTAM VENKATESH.

Similar presentations


Presentation on theme: "Markup Languages & XML - BY VISHAL KAMTAM VENKATESH."— Presentation transcript:

1 Markup Languages & XML - BY VISHAL KAMTAM VENKATESH

2 What are markup languages??  Language that uses tags to define elements within a document.  It is human-readable.  The two most popular markup languages are HTML and XML.

3 What is HTML?  HTML-Hyper text Markup Language.  HTML is comprised of “elements” and “tags”  Begins with and ends with  Elements (tags) are nested one inside another: Tags have attributes:  HTML describes structure using two main sections: and

4 Example HTML code: Hello World Hello World

5 Output:

6 How they work?

7 Representation of HTML as Parse Tree Hello World

8 Representation in CFG  HTML can be described by classes of text  Text is any string of characters literally interpreted (i.e. there are no tags, user-text)  Char is any single character legal in HTML tags.Blanks included  Element is  Text or  A pair of matching tags and the document between them, or  Unmatched tag followed by a document  Doc is sequences of elements  ListItem is the tag followed by a document followed by  List is a sequence of zero or more list items

9 HTML Grammar Char a | A | … Text ε | Char Text Doc ε | Element Doc Element Text | Doc | Doc | List ListItem Doc List ε | ListItem | List

10 HTML Example popular markup languages HTML XML The text can be viewed as : popular markup languages 1. HTML 2. XML

11 Extensible Mark-up languages (XML)

12  XML has user defined tags whereas HTML has predefined tags.  designed to describe data, not to display data. eg: ” 12 Maple Street ” 12 Maple Street  In most web applications, XML is used to describe data, while HTML is used to format and display the data.

13 Example XML Mary likes John.

14 PARSE TREE

15 PRODUCTION RULES → → Mary|John → believes → likes

16 XML’s DTD  The DTD lets us define our own grammar  Context-free grammar notation, also using regular expressions  Form of DTD:  Element definition:

17 Element Description  Element descriptions are regular expressions  Basis  Other element names  #PCDATA, for any TEXT without tags  Operators  | for union , for concatenation  * zero or more occurrences of  ? for zero or one occurrence of  + for one or more occurrences of

18 Example DTD-1 <!DOCTYPE PcSpecifications [ ]>

19 Pc Specs XML Document 4560 $2295 Intel Pentium 4Ghz 8192 Maxtor Diamond 2000Gb 32x …..

20 DTD and Production Rules  DTD: Production Rule: PROCESSOR  MANF MODEL SPEED  DTD: <!ELEMENT DISK (HARDDISK|CD|DVD) Production Rule: Disk  HARDDISK|CD|DVD  DTD:

21  Production Rule: PC  AB A  Model Price Processor Ram B  Disk+  Last production is illegal.we introduce C B  CB|C C  Disk  We can rewrite above expression PC  Model Price Processor Ram B B  Disk B|Disk

22 Example DTD-2  <!DOCTYPE SENTENCES [ }>

23 Production Rules (SENTENCE)  (NOUN-PHRASE)(VERB-PHRASE) (NOUN-PHRASE)  (CMPLX-NOUN)|(CMPLX-NOUN)(PREP-PHRASE) (VERB-PHRASE)  (CMPLX-VERB)|(CMPLX-VERB)(PREP-PHRASE) (PREP-PHRASE)  (PREP)(CMPLX-NOUN) (CMPLX-NOUN)  (ARTICLE)(NOUN) (ARTICLE)  A|THE (NOUN)  BOY|GIRL|FLOWER (VERB)  TOUCHES|LIKES|SEES (PREP)  WITH

24 CONCLUSION  DTD for both XML and CFG describe languages with certain rules and restrictions, and thereby declare what’s legal and what’s not in a given language.  An XML document is considered valid if it’s well formed and has been validated against a DTD.  A string is a valid string in a given Context-free language if the Context-free grammar for that language can generate it.

25 Reference Links:  http://www.math.uaa.alaska.edu/~afkjm/cs351/handouts/cfg.pdf http://www.math.uaa.alaska.edu/~afkjm/cs351/handouts/cfg.pdf  http://taligarsiel.com/Projects/howbrowserswork1.htm#w3c http://taligarsiel.com/Projects/howbrowserswork1.htm#w3c  http://www.w3.org/People/Bos/Schema/schemas http://www.w3.org/People/Bos/Schema/schemas  http://www.dcs.bbk.ac.uk/~ptw/teaching/dtd-new/notes.html http://www.dcs.bbk.ac.uk/~ptw/teaching/dtd-new/notes.html

26 THANKYOU!!!!!!


Download ppt "Markup Languages & XML - BY VISHAL KAMTAM VENKATESH."

Similar presentations


Ads by Google