1 / 28

XML (eXtensible Markup Language)

XML (eXtensible Markup Language). DB niky 10/29/1999. Outline. Two examples History Logical and Physical Structure Element (logical structure) Attribute (logical structure) Entity (physical structure) Notation (physical structure) Include && Ignore (logical structure). Two examples.

caron
Download Presentation

XML (eXtensible Markup Language)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML (eXtensible Markup Language) DB niky 10/29/1999

  2. Outline • Two examples • History • Logical and Physical Structure • Element (logical structure) • Attribute (logical structure) • Entity (physical structure) • Notation (physical structure) • Include && Ignore (logical structure)

  3. Two examples A book Example: HTML, XML An e-mail example: XML, HTML 資料與顯示分開,可以單獨修改 文件具自我描述能力 valid, well-formed

  4. History • SGML (Standard Generalized Markup Language) 1986 too complex • HTML (Hyper Text Markup Language) 1991 an application of SGML SGML context free grammar DTD c grammar HTML c program • XML (eXtensible Markup Language) 1996 a subset of SGML

  5. Logical and Physical Structure Logical Structure: the markup used to indicate the kinds of information stored in a document and their relationship a book: title, chapters, paragraphs Physical Structure: If a document stores information in files, the markup will identify the files and their location. store XML text(parsed) or non-XML text(unparsed) reuse data

  6. Element(logical structure) <!ELEMENT ElementName ContentSpecification> ContentSpecification: EMPTY ANY #PCDATA children Mixed Content example…

  7. Attribute(logical structure) <!ATTLIST ElementName AttributeName Type Default> Type: ID IDREF IDREFS CDATA(字元資料) ENTITY ENTITIES NMTOKEN NMTOKENS(字母,數字,虛線,冒號,底線) NOTATION Enumerated <!ATTLIST EMAIL LANGUAGE (Western|Greek|Latin|Universal) "Western" ENCRYPTED CDATA #IMPLIED PRIORITY (NORMAL|LOW|HIGH) "NORMAL">

  8. Default: #REQUIRED #IMPLIED Default #FIXED FixedValue

  9. Entity(physical structure) <!ENTITY SIGNATURE "Bill"> <!ENTITY Image SYSTEM “Image.gif” NDATA GIF> <!ENTITY % tabledecls SYSTEM “cals.dtd”> parsed, unparsed internal, external general, parameter <!ENTITY EntityName EntityDefinition> <!ENTITY % EntityName EntityDefinition> EntityDefinition: EntityValue | ExternalID

  10. Reference in Content (in DTD) <!ENTITY SIGNATURE "Bill"> (in Document) <BODY> Hello, this is &SIGNATURE;. Take care, -&SIGNATURE; </BODY> (result) <BODY> Hello, this is Bill. Take care, -Bill </BODY>

  11. Reference in Attribute ValueReference as Attribute Value (in DTD) <!ENTITY gEnt “Spanish”> <!ENTITY unparsedEnt SYSTEM “clown.jpg” NDATA JPEG> <!ATTLIST para style CDATA #IMPLIED picfile ENTITY #IMPLIED> (in Document) <para style=“n &gEnt;” picfile=“unparsedEnt”> (result) <para style=“n Spanish” picfile=“unparsedEnt”>

  12. Reference in Entity Value <!ENTITY gEnt1 “Spanish”> <!ENTITY gEnt2 “English”> <!ENTITY gEnt3 “&gEnt1; and &gEnt2;> <!ENTITY % pEnt “Chinese”> <!ENTITY gEnt4 “Language: %pEnt;”> (result) <!ENTITY gEnt3 “&gEnt1; and &gEnt2;> <---- Bypassed <!ENTITY gEnt4 “Language: Chinese”>

  13. Reference in DTD <!ENTITY % ent1 “para”> <!ELEMENT notice (title, %ent1;)> (result) <!ELEMENT notice (title, para)> <!ENTITY % ent1 “ra”> <!ELEMENT notice (title, pa%ent1;)> (result) <!ELEMENT notice (title, pa ra)> <--- Won’t work. <--- Included as PE

  14. Notation(physical structure) (in DTD) <!NOTATION JPEG SYSTEM “jpegviewer.exe”> <!NOTATION JPEG SYSTEM “Joint Photographic Experts Group”>

  15. Include && Ignore(logical structure) <![INCLUDE [DTD section]]> <![IGNORE [DTD section]]> (in DTD) <!ENTITY % SUCURE “IGNORE”> <!ENTITY % UNSUCURE “INCLUDE”> <![%SECURE; [any number of declarations]]> <![%UNSECURE; [any number of declarations]]>

  16. Element <!ELEMENT note (img?, para, desc)> <!ELEMENT img EMPTY> <!ELEMENT para (#PCDATA | img) *> <!ELEMENT desc ANY> back

  17. Attribute <!ATTLIST poem author NMTOKEN #REQUIRED> <!ATTLIST verse flavor (chocolate | mint) “mint” hatsize CDATA #IMPLIED> <!NOTATION JPEG SYSTEM “jpgview.exe”> <!ENTITY clownpic SYSTEM “clown.jpg” NDATA JPEG> <!ELEMENT illustration EMPTY> <!ATTLIST illustration picfile ENTITY #REQUIRED> <illustration picfile=“clownpic”/> back

  18. ID IDREFS (in DTD) <!ELEMENT title (#PCDATA)> <!ATTLIST title pics IDEREFS #REQUIRED> <!ELEMENT picture (#PCDATA)> <!ATTLIST picture uid ID #REQUIRED> (in Document) <title pics=“y1 y2 y3”> My Vacation </title> <picture uid=“y1”> La Brea Tar Pits </picture> <picture uid=“y2”> Land of Little Horses </picture> <picture uid=“y3”> South of the Border </picture> back

  19. <h1> 推薦叢書 </h1> <table border=1 cellpadding=5> <tr> <th> 名稱 </th> <th> 作者 </th> <th> 售價 (新台幣) </th> </tr> <tr> <td> 煞死你的網頁設計絕招 </td> <td> 胭脂虎 </td> <td align="right"> 590 </td> </tr> <tr> <td> 如何在 7-11 白吃白喝 </td> <td> 無名氏 </td> <td align="right"> 120 </td> </tr> </table> ie5

  20. <?xml version="1.0" encoding="Big5"?> <推薦叢書> <書籍> <名稱> 煞死你的網頁設計絕招 </名稱> <作者> 胭脂虎 </作者> <售價 貨幣單位="新台幣"> 590 </售價> </書籍> <書籍> <名稱> 如何在 7-11 白吃白喝 </名稱> <作者> 無名氏 </作者> <售價 貨幣單位="新台幣"> 120 </售價> </書籍> </推薦叢書> ie5

  21. <?xml version="1.0" encoding="Big5"?> <!ELEMENT 推薦叢書 (書籍*)> <!ELEMENT 書籍 (名稱, 作者+, 售價*)> <!ELEMENT 名稱 (#PCDATA)> <!ELEMENT 作者 (#PCDATA)> <!ELEMENT 售價 (#PCDATA)> <!ATTLIST 售價 貨幣單位 (新台幣|人民幣|港幣| 美元) "新台幣">

  22. <?xml version="1.0" encoding="Big5"?> <!DOCTYPE 推薦叢書 SYSTEM "example2.dtd"> <推薦叢書> <書籍> <名稱> 煞死你的網頁設計絕招 </名稱> <作者> 胭脂虎 </作者> <售價 貨幣單位="新台幣"> 590 </售價> </書籍> <書籍> <名稱> 如何在 7-11 白吃白喝 </名稱> <作者> 無名氏 </作者> <售價 貨幣單位="新台幣"> 120 </售價> </書籍> </推薦叢書> back

  23. <?xml version="1.0"?> <!DOCTYPE EMAIL [ <!ELEMENT EMAIL (TO, FROM, CC, SUBJECT, BODY)> <!ELEMENT TO (#PCDATA)> <!ELEMENT FROM (#PCDATA)> <!ELEMENT CC (#PCDATA)> <!ELEMENT SUBJECT (#PCDATA)> <!ELEMENT BODY (#PCDATA)> ]>

  24. <?xml version="1.0"?> <!DOCTYPE EMAIL SYSTEM “email.dtd"> <EMAIL> <TO>Jodie@msn.com</TO> <FROM>Bill@msn.com</FROM> <CC>Philip@msn.com</CC> <SUBJECT> My First DTD </SUBJECT> <BODY> Hello, World! </BODY> </EMAIL>

  25. <?xml version="1.0"?> <!ELEMENT EMAIL (TO+, FROM, CC*, BCC*, SUBJECT?, BODY?)> <!ATTLIST EMAIL LANGUAGE (Western|Greek|Latin|Universal) "Western" ENCRYPTED CDATA #IMPLIED PRIORITY (NORMAL|LOW|HIGH) "NORMAL"> <!ELEMENT TO (#PCDATA)> <!ELEMENT FROM (#PCDATA)> <!ELEMENT CC (#PCDATA)> <!ELEMENT BCC (#PCDATA)> <!ATTLIST BCC HIDDEN CDATA #FIXED "TRUE"> <!ELEMENT SUBJECT (#PCDATA)> <!ELEMENT BODY (#PCDATA)> <!ENTITY SIGNATURE "Bill"> back

  26. <?xml version="1.0"?> <!DOCTYPE EMAIL SYSTEM “email.dtd"> <EMAIL LANGUAGE="Western" ENCRYPTED="128" PRIORITY="HIGH"> <TO>Jodie@msn.com</TO> <FROM>&SIGNATURE;@msn.com</FROM> <CC>Philip@msn.com</CC> <BCC>Naomi@msn.com</BCC> <SUBJECT>Sample Document with External DTD</SUBJECT> <BODY> Hello, this is &SIGNATURE;. Take care, -&SIGNATURE; </BODY> </EMAIL> ie5

  27. <?xml version="1.0"?> <!DOCTYPE EMAIL SYSTEM "Lst4_4.dtd" [ <!ENTITY SIGNATURE "Joe"> ]> <EMAIL LANGUAGE="Western" ENCRYPTED="128" PRIORITY="HIGH"> <TO>Jodie@msn.com</TO> <FROM>&SIGNATURE;@msn.com</FROM> <CC>Philip @msn.com</CC> <BCC>Naomi@msn.com</BCC> <SUBJECT>Sample Document with External DTD</SUBJECT> <BODY> Hello, this is &SIGNATURE;. Take care, -&SIGNATURE; </BODY> </EMAIL> ie5back

More Related