Presentation is loading. Please wait.

Presentation is loading. Please wait.

MIS 315 Bsharah An Introduction to XML 1MIS 315 - Bsharah.

Similar presentations


Presentation on theme: "MIS 315 Bsharah An Introduction to XML 1MIS 315 - Bsharah."— Presentation transcript:

1 MIS 315 Bsharah An Introduction to XML 1MIS 315 - Bsharah

2 XML-1.0 Definition EXtensible Markup Language - XML Meta-Markup Language to describe information –Hierarchical Structure with a Tag Based Syntax for data descriptions –Elements and attributes define vocabulary semantics Text based tagged record format –Tags bracket and describe record –Record can be any text (word, sentence, paragraph, etc.) –Start and end tags for each record Includes robust architecture components for utilization –http://www.w3.org/TR/2000/REC-xml-20001006http://www.w3.org/TR/2000/REC-xml-20001006 2MIS 315 - Bsharah

3 Key Driver for XML Adoption is Improved Business Flexibility Today’s extended enterprise is virtual –Boundaries are a moving target –New partnerships focus on E-Business business transactions –Communications typically over public internet Loosely coupled business relationships are defined –Enable rapid integration of new relationships –Remove requirements for “fixed” IT infrastructure dedicated communication links “hardwired” system interfaces Internet protocols (XML/HTTP) emerging as de facto e- business standards –pervasive, worldwide acceptance –rapidly evolving to meet wide range of needs 3MIS 315 - Bsharah

4 XML Meets Business Needs for Enterprise Web Application Development User Customer Public Internet XML/HTTP Internet Business Enterprise Business Enterprise Firewall Web Service App Server Data Server User Firewall Web Service App Server Data Server User Slide: 4MIS 315 - Bsharah

5 XML is a Meta-Language for Defining Information Document (information) is defined by: –Declaration: identifies XML version and schema information –Comments: describes the document –Elements: define records of document, metadata –Attributes: identify values for elements Document (information) is constrained by XML architecture components: –Schemas: describes what a document may contain DTDs: document type definition; the document structure –Namespaces: allows use of multiple data sources in single file 5MIS 315 - Bsharah

6 Benefits of XML Facilitates development of flexible Web Applications –Data integration and transformation from disparate sources –Data separated from presentation –Multiple views of the same data Enables more usable applications –Describes data content, not just interface –Supports automated processing for searches, applications, EDI Widely supported for ease of implementation –Open standard; multiple programming languages –Human and machine interpretable –Uses common Web infrastructure and industry products 6MIS 315 - Bsharah

7 Where Did XML Come From? XML is a much simplified form of Standard Generalized Markup Language (SGML) –SGML (focused on exchange of complex document formats) –W3C standard for document exchange –Supported by commercial authoring and viewing tools Internet needed easier to use markup language –more robust than HTML –easier to use; less complicated than SGML –usable in browser, HTTP, internet environment XML result is a W3C recommendation –defines XML syntax –identifies related components for extension 7MIS 315 - Bsharah

8 Who “Owns” XML? XML technology standard - http://www.w3c.orghttp://www.w3c.org –Internet related standards body –manages variety of Internet standards HTTP XML XML domain specific standards - for example, Automotive –define common “document” definitions for industry information –AIAG: http://www.aiag.org/projects/pp423.htmlhttp://www.aiag.org/projects/pp423.html –STEP: http://www.stepml.org/http://www.stepml.org/ –OAG: http://www.openapplications.org/xml/loadform.htmhttp://www.openapplications.org/xml/loadform.htm –etc. XML enterprise specific definitions –recommended only when external standards are not available –common registry for enterprise use / re-use 8MIS 315 - Bsharah

9 XML Document Document Prolog Body Epilog http://myserver.com/books.dtd Raj Birla The XML Story Raj Birla The XML Story Document Root Element Root Books Book category Author Title 9MIS 315 - Bsharah

10 Constructing a DTD Step 1 – Declare the XML Document –The XML declaration is the first line in every XML document. –The entire line is a processing instruction that is enclosed within the processing instruction delimiters,. – Step 2 – Refer to a DTD –The document type declaration must precede the first start tag in an XML document. –Starts with the !DOCTYPE keyword and either contains a complete internal DTD subset or refers to a separate external DTD. 10MIS 315 - Bsharah

11 Constructing a DTD Step 2 – Refer to a DTD (con’t) Internal Declaration – External Declaration – –For an external DTD, the uniform resource identifier (URI) can be either an absolute address or a relative address. Absolute address example: http://ecommerce.org/schema/011showpo006.dtd http://ecommerce.org/schema/011showpo006.dtd Relative address example: schema/011showpo006.dtd schema/011showpo006.dtd 11MIS 315 - Bsharah

12 Constructing a DTD Step 3 – Define the Root Element and Its Child Elements – pet_store (root) purchases creature feed creature_type species daily_feed daily_feed_quantity 12MIS 315 - Bsharah

13 Constructing a DTD Step 4 – Specify Element Occurrences and Order –{?} Indicates that an element can occur once, but does not have to occur at all. –{*} Indicates that an element can occur an unlimited number of times. –{+} Indicates that an element must occur one or more times. –{,} Indicates the exact order in which the elements appear; a sequence list. –{|} Indicates that element data can occur in any order; choice list. Example: – –<!DOCTYPE pet_store [ … – ]> 13MIS 315 - Bsharah

14 Constructing a DTD Step 5 – Specify Attribute Lists and Default Values –Set Attribute Types CDATA = character data, string type ID = tokenized type, unique identification value IDREF, IDREFS = tokenized type, cross reference to one or more ID values ENTITY, ENTITIES = tokenized type, refers to one or more pre- defined entities NMTOKEN, NMTOKENS = tokenized type, refers to one or more name tokens NOTATION, enumerated NOTATION = refers to one or more values specified by a notation declaration –Specify If Attribute Is Required or Optional #REQUIRED = attribute must appear in every instance of the element #IMPLIED = attribute may optionally appear on an instance of the element #FIXED plus default value = must always have default value Default Value = if attribute does not appear, the default value is assumed, if the attribute appears it may have another value. 14MIS 315 - Bsharah

15 Constructing a DTD Step 5 – Specify Attribute Lists and Default Values (con’t) – 15MIS 315 - Bsharah

16 Constructing a DTD Step 6 – Define and Declare Entities –Syntax: –For an externally sourced set of replacement content, precede “Entity_Definition” with a SYSTEM | PUBLIC keyword SYSTEM = local server or network PUBLIC = a public resource –Examples: – 16MIS 315 - Bsharah

17 Constructing a DTD Step 7 – Define lists and tables –List definition is through two ELEMENT declarations –Table definition is through three ELEMENT Declarations Or – 17MIS 315 - Bsharah

18 DTD Example for oldjoke <!DOCTYPE oldjoke [Start of oldjoke DTD <!ELEMENT oldjokeDTD ELEMENT declaration for oldjoke (burns+, allen, applause?)>defines allowed subelement names for oldjoke <!ELEMENT burnsdefines subelement: burns (#PCDATA | quote)*>allowed burns content is: PCDATA or quote <!ELEMENT allendefines subelement: allen (#PCDATA | quote)*>allowed allen content is: PCDATA or quote <!ELEMENT quotedefines subelement:quote (#PCDATA)*>allowed quote content is PCDATA defines subelement: applause as EMPTY ]identifies the end of oldjoke DTD Special Syntax Notes: Allowed operators are: Optional (?), one-or-more (+), and zero-or-more (*) (B | C | (D, E)) defines allowed values group of B or C or sequence D, E Slide: 18MIS 315 - Bsharah

19 Constructing a Valid XML Document Step 1 – Plan and Prepare –To build a valid XML Document, you must completely understand its DTD. –Test the DTD for correctness, syntax and semantics Step 1a – Declare XML Characteristics –The XML declaration is the first line in every XML Document. Step 1b – Set Document Type and Associated DTD –Internal –External 19MIS 315 - Bsharah

20 Constructing a Valid XML Document Step 2 – Insert Elements based on the DTD and Add Attributes and attribute values. Example: llama Vicuna … DTD <!DOCTYPE pet_store [ …]> DTD <!DOCTYPE pet_store [ …]> 20MIS 315 - Bsharah

21 Constructing a Valid XML Document Step 3 – Insert Entities <!DOCTYPE pet_store [ …]> Store Sales &Storewthr; … 55-60 Rain wthr.xml Note: Previously created file, stored at network node: rick/weather/current. 21MIS 315 - Bsharah

22 ENTITY Creation (Using ENTITY as an attribute type) Three Steps –Declare the ENTITY(s) for use with the attribute. –Declare an attribute of type ENTITY for the element –Create an instance of the element type in the document, providing the attribute and an entity name as the value. Example: – –... – Family trip 4th of July… – 22MIS 315 - Bsharah

23 Constructing a Valid XML Document Step 4 – Build Lists and Tables Rick’s Account Date Vendor Amount Description 1/2/2001 Phone Company $43.75 Monthly statement MIS 315 - Bsharah Slide: 23 DTD for register table DTD for register table

24 Simple XML Example XML Declaration statement; uses version 1.0 XML Document root element, start-tag: oldjoke Subelement start-tag: burns; content of element: oldjoke SayFirst part of content of element: burns Subelement of burns, start-tag: quote goodnight,Content of element: quote End-tag of element: quote Gracie.Additional content of element: burns End-tag of element: burns New subelement of oldjoke, start-tag: allen Subelement of allen, start-tag: quote Goodnight, Gracie.Content of element: quote End-tag of element: quote End-tag of element: allen Empty Element Tag: applause (special case of syntax) End-tag for root element: oldjoke MIS 315 - Bsharah Slide: 24

25 Complete Document for Pet Store Example <!DOCTYPE pet_store [ ]> llama Vicuna Ruminant Grain Feed 2 <!DOCTYPE pet_store [ ]> llama Vicuna Ruminant Grain Feed 2 Slide: 25MIS 315 - Bsharah


Download ppt "MIS 315 Bsharah An Introduction to XML 1MIS 315 - Bsharah."

Similar presentations


Ads by Google