COMP9321 Web Application Engineering Extensible Markup .

1y ago
6 Views
3 Downloads
5.45 MB
77 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Ronnie Bonney
Transcription

COMP9321 Web Application EngineeringExtensible Markup Language (XML)Dr. Basem SuleimanService Oriented Computing Group, CSE, UNSW AustraliaSemester 1, 2016, Week ex.php?cid 2442COMP9321, 16s1, Week 41

Acknowledgement/ContributionsService Oriented Computing Group, CSE, UNSW Australia Dr. Helen Paik Prof. Boualem Bentallah Dr. Srikumar Venugopal Dr. Moshe Chai Barukh Dr. Amin Beheshti Dr. Basem Suleiman Many others from service oriented computing groupCOMP9321, 16s1, Week 32

Extensible Markup Language (XML) XML is a markup language much like HTML HTML: HTML was designed to display data. HTML tags are not predefined. XML: XML was designed to describe data. XML tags are not predefined. XML is designed to be self-descriptive XML is a W3C Recommendation XML is derived from SGML (ISO 8879). (Standard Generalized Markup Language) is a standard for how tospecify a document markup language or tag set.COMP9321, 16s1, Week 43

Extensible Markup Language (XML) XML originally designed to meet the challenges of large-scaleelectronic publishing. XML separates presentation issues from the actual data. XML plays an increasingly important role in the exchange of awide variety of data on the Web and elsewhere. Needs a communication protocol? e.g. SOAP stands for Simple Object Access Protocol SOAP is based on XML SOAP is a W3C recommendation SOAP uses XML Information Set for its message format.COMP9321, 16s1, Week 44

Extensible Markup Language (XML)COMP9321, 16s1, Week 45

XML: Tags, tagsConsider the following snippet of information from a staff list:COMP9321, 16s1, Week 46

Why XML?COMP9321, 16s1, Week 47

Why XML?COMP9321, 16s1, Week 48

Separating the Content from PresentationHTML was designed to display data. CSS: Cascading Style SheetsCSS defines how HTML elements are to be displayedAll formatting could be removed from the HTMLdocument, and stored in a separate CSS file.XML was designed to describe data.COMP9321, 16s1, Week 49

Separating the Content from PresentationCOMP9321, 16s1, Week 410

XML ApplicationsCOMP9321, 16s1, Week 411

XML ApplicationsRSS : Really Simple SyndicationWith RSS it is possible to distribute up-to-date web content from one web site tothousands of other web sites around the world. RSS is written in XMLRSS allows you to syndicate your site contentRSS defines an easy way to share and view headlines and contentRSS files can be automatically updatedRSS allows personalized views for different sitesRSS is useful for web sites that are updated frequently, like: e.g. News sites, Companies, and Calendars.Without RSS, users will have to check your site daily for new updates.COMP9321, 16s1, Week 412

XML ApplicationsRSS : Really Simple SyndicationWith RSS it is possible to distribute up-to-date web content from one web site tothousands of other web sites around the world. RSS is written in XMLRSS allows you to syndicate your site contentRSS defines an easy way to share and view headlines and contentRSS files can be automatically updatedRSS allows personalized views for different sitesRSS is useful for web sites that are updated frequently, like: e.g. News sites, Companies, and Calendars.Without RSS, users will have to check your site daily for new updates.COMP9321, 16s1, Week 413

XML is COMP9321, 16s1, Week 414

Quick XML syntaxCOMP9321, 16s1, Week 415

The XML FamilyXML: a markup language used to describe information.COMP9321, 16s1, Week 416

The XML FamilyXML: a markup language used to describe information.Document Object Model (DOM ) XML DOM defines a standard for accessing and manipulating XML documents.The DOM presents an XML document as a tree-structure.The DOM is a W3C standard.The DOM is separated into 3 different parts / levels: Core DOM - standard model for any structured document XML DOM - standard model for XML documents A standard object model for XML A standard programming interface for XML Platform- and language-independent HTML DOM - standard model for HTML documentsCOMP9321, 16s1, Week 417

The XML FamilyXML: a markup language used to describe information.Document Object Model (DOM): XML DOM defines a standard for accessing and manipulating XML documents.The DOM presents an XML document as a tree-structure.The DOM is a W3C standard.The DOM is separated into 3 different parts / levels: Core DOM - standard model for any structured document XML DOM - standard model for XML documents A standard object model for XML A standard programming interface for XML Platform- and language-independent HTML DOM - standard model for HTML documentsCOMP9321, 16s1, Week 418

XML Document: Bookstore ExampleUsing xml-formatter, Web Toolkit Online COMP9321, 16s1, Week 419

XML Tree Structure: Bookstore ExampleSource: http://www.w3schools.com/xml/xml tree.aspCOMP9321, 16s1, Week 420

The XML Family – Basics XML documents are formed as element trees XML prolog: XML version and encoding character ?xml version "1.0" encoding "UTF-8"? An XML tree starts at a root element bookstore and branches from the rootto child elements (e.g., book ) All elements can have sub elements (child elements, e.g., author ) The terms parent, child, and sibling describes the relationships between elements Parent have children. Children have parents. Siblings are children on the samelevel (brothers and sisters) All elements can have text content (e.g., Everyday Italian) and attributes (e.g., book category "cooking" ) Elements has starting and closing tags ( price /price )COMP9321, 16s1, Week 421

The XML Family – Basics XML tags are case sensitive. Student is different from student All elements must be properly nested within each other Attribute values must always be quoted - student id "3230813" Comments !-- XML comments -- White spaces are preserved in XML (in contrast to HTML) XML Stores New Line as LF (carriage return and line feed) Entity References Some characters are reserved andhave special meaning in XML,e.g., , , & Must be escaped using entityreferences Age should be < 25 /Age COMP9321, 16s1, Week 4CharacterEntity reference (less than)< (greater than)>& (ampersand)&‘ (apostrophe)'" (quotation)"22

XML – Document Type Definition An XML document with correct syntax is called "Well Formed“ Errors (incorrect syntax) – application processing will trigger errors Well Formed XML document it has valid XML syntax rules Well formed XML document “valid” XML document ? A valid XML document must be: Well formed AND Conform to Document Type Definition (DTD) Document Type Definition (DTD) Defines the structure and the legal elements and attributes of an XML document DTD or XML Schema (XML alternative to DTD) Internal DTD declaration or external DTD declaration (.dtd)COMP9321, 16s1, Week 423

DTD ParsingIn DTD Parsed Character DATA (PCDATA) Text that WILL be parsed by a parser. - tags inside the text will betreated as markup and entities will be expanded Character Data (CDATA ) Text that will NOT be parsed by a parser – tags inside the text willNOT be treated and entities will not be expanded.COMP9321, 16s1, Week 424

Phonebook.xml with Internal DTDCOMP9321, 16s1, Week 425

Phonebook.xml with External DTD. Phonebook.dtdCOMP9321, 16s1, Week 426

CDATA SectionCOMP9321, 16s1, Week 427

Defining XML Content: ElementsCOMP9321, 16s1, Week 428

Defining XML Content: ModifiersCOMP9321, 16s1, Week 429

Defining XML Content: Choices, EmptyCOMP9321, 16s1, Week 430

Defining XML Content: Mixed content, AnyCOMP9321, 16s1, Week 431

Defining XML Content: Creating AttributesCOMP9321, 16s1, Week 432

Defining XML Content: Creating AttributesCOMP9321, 16s1, Week 433

XML Custom EntitiesCOMP9321, 16s1, Week 434

Parameter EntitiesCOMP9321, 16s1, Week 435

Well-formedness and Validity of XMLCOMP9321, 16s1, Week 436

Limitations of DTDCOMP9321, 16s1, Week 437

The XML Family – XML SchemaXML Schema (or SML Schema Definition XSD) is an XML-based alternative to DTD. describes the structure of an XML document. defines elements and attributes that can appear in a document defines data types for elements and attributes defines default and fixed values for elements and attributes defines the child elements, their orders, etc. XML Schemas are much more powerful than DTDs. The XML Schema language is also referred to as XML Schema Definition (XSD).COMP9321, 16s1, Week 438

The XML Family – XML SchemaXML Schema (orXSD) W3C's recommendation for replacing DTD with features such as: Simple and complex data types Type derivation and inheritance Namespace-aware element and attributes Limits on number of appearances by an element Combining with regular expressions for finer control over document structure Most importantly, XML Schemas are well-formed XML documentsthemselvesCOMP9321, 16s1, Week 439

XML NamespacesCOMP9321, 16s1, Week 440

XML Namespaces (example)COMP9321, 16s1, Week 441

XML NamespacesCOMP9321, 16s1, Week 442

Previous examples can now be .COMP9321, 16s1, Week 443

XML Namespace SyntaxCOMP9321, 16s1, Week 444

XML Schema Definition (XSD) a recommendation of the World Wide Web Consortium (W3C) specifies how to formally describe the elements in an ExtensibleMarkup Language (XML) document.COMP9321, 16s1, Week 445

Simple TypesCOMP9321, 16s1, Week 446

Attributes attribute name “attribute-name" type “attribute-type“ use “uu”/ Built-in data types String, decimal, integer, boolean, date, time A default value is automatically assigned to the attribute when noother value is specified A fixed value is also automatically assigned to the attribute, and youcannot specify another value Attributes are optional by default, otherwise use "required"COMP9321, 16s1, Week 447

Type RestrictionsMore examples : http://www.w3schools.com/xml/schema facets.aspCOMP9321, 16s1, Week 448

Type s a list of acceptable valuesfractionDigits Specifies the maxi number of decimal places allowed. Must be equal to or greater thanzerolengthSpecifies the exact number of characters or list items allowed. Must be than zeromaxExclusive Specifies the upper bounds for numeric values (the value must be less than this value)maxInclusive Specifies the upper bounds for numeric values (the value must be to this value)maxLengthSpecifies the Max number of characters or list items allowed. Must be zerominExclusive Specifies the lower bounds for numeric values (the value must be greater than thisvalue)minInclusiveSpecifies the lower bounds for numeric values (the value must be to this value)minLengthSpecifies the minimum number of characters or list items allowed. Must be 0patternDefines the exact sequence of characters that are acceptabletotalDigitsSpecifies the exact number of digits allowed. Must be greater than zerowhiteSpaceSpecifies how white space (line feeds, tabs, spaces, and carriage returns) is handledMore examples : http://www.w3schools.com/xml/schema facets.aspCOMP9321, 16s1, Week 449

Complex TypesCOMP9321, 16s1, Week 450

Complex TypesCOMP9321, 16s1, Week 451

XML Example - Creating XSDShiporder.xmlShiporder.xsdSource: http://www.w3schools.com/xml/schema example.aspCOMP9321, 16s1, Week 452

The XML Family – XSL and XSLTXML: a markup language used to describe information.DOM: a programming interface for accessing and updating documents.DTD and XML Schema: describes the structure and content of XML documents.XSLT: XSL stands for eXtensible Stylesheet Language, and is a style sheet languagefor XML documents. CSS Style Sheets for HTML XSL Style Sheets for XML XSL describes how the XML document should be displayed! XSLT (XSL Transformations) a language for transforming XML documents.COMP9321, 16s1, Week 453

The XML FamilyXML: a markup language used to describe information.DOM: a programming interface for accessing and updating documents.DTD and XML Schema: describes the structure and content of XML documents.XSLT: a language for transforming XML documentsCOMP9321, 16s1, Week 454

The XML Family - XPathXML: a markup language used to describe information.DOM: a programming interface for accessing and updating documents.DTD and XML Schema: describes the structure and content of XML documents.XSLT: a language for transforming XML documentsXPath: XPath (XML Path language) is a language for finding information in an XMLdocument. XPath contains a library of standard functions XPath is a major element in XSLT XPath is also used in XQuery, XPointer and XLink XPath is a W3C recommendationCOMP9321, 16s1, Week 455

The XML Family – XPath Examples ?xmla version "1.0" . used to describesome XPathexpressions:XML:markup languageinformation. comp9321 students DOM: a programming interface for accessing and updating documents. student /comp9321 ctureand“student”contentelementof XML Selectsthe firstthat documents.is the child id 50001 /id XSLT:a languageB. /name for transforming XMLdocumentsof the“comp9321 student” element name AdamXPath: program 8543 /program /comp9321 student/student[last()] XPath(XML Path language) is a languagefor finding information in an XML stage 1 /stage Selects the last “student” element that is the child of /student document.the “comp9321 student” element student XPath contains a library of standard functions id 50002 /id XPathis a major element in XSLT/comp9321 student/student[position() 3] name AlexC. /name XPath is also used in XQuery, XPointerand Selects thefirstXLinktwo “student” element that is the program 3978 /program XPath is a W3C recommendationchild of the “comp9321 student” element stage 3 /stage /student /comp9321 students /comp9321 student/student[stage 2] Selects all the “student” elements of the“comp9321 student” element that have a “stage” elementwith a value greater than 2. COMP9321, 16s1, Week 456

The XML FamilyXML: a markup language used to describe information.DOM: a programming interface for accessing and updating documents.DTD and XML Schema: describes the structure and content of XML documents.XSLT: a language for transforming XML documentsXPath: a query language for navigating XML documents.XPointer: for identifying fragments of a document.XLink: generalises the concept of a hypertext link.XInclude: for merging documents.XQuery: a language for making queries across documents.RDF: a language for describing resources.COMP9321, 16s1, Week 457

An XML document is a tree .COMP9321, 16s1, Week 458

Attributes in XML tagsCOMP9321, 16s1, Week 459

Attributes in XML tagsCOMP9321, 16s1, Week 460

Parsing XML documents with JavaCOMP9321, 16s1, Week 461

Parsing XML documents with JavaCOMP9321, 16s1, Week 462

SAX and DOM as the Standard InterfacesCOMP9321, 16s1, Week 463

Document Object Model (DOM)COMP9321, 16s1, Week 464

Dealing with Nodes in DOMCOMP9321, 16s1, Week 465

An example XML here .COMP9321, 16s1, Week 466

DOM for XMLCOMP9321, 16s1, Week 467

Using a DOM Parser (eg., Apache Xerces)COMP9321, 16s1, Week 468

Document Interface MethodsCOMP9321, 16s1, Week 469

Examples of Node Properties (XML), p.9.25COMP9321, 16s1, Week 470

Count/Print the number of 'book' elementsCOMP9321, 16s1, Week 471

Dealing with Nodes in DOMNode interface oc/org/w3c/dom/Node.htmlCOMP9321, 16s1, Week 472

Dealing with NodesCOMP9321, 16s1, Week 473

The Element interfaceElement Interface documentation – full list of methods and org/w3c/dom/Element.htmlCOMP9321, 16s1, Week 474

More with DOM .COMP9321, 16s1, Week 475

References http://www.w3.org/XML/ XML in a nutshell, Chapters 9 and 10 ma/ http://www.w3schools.com/xml/ Some examples in these notes are originated from Dr. David Edmond from QUT,BrisbaneCOMP9321, 16s1, Week 476

COMP9321, 16s1, Week 477

XML: a markup language used to describe information. DOM: a programming interface for accessing and updating documents. DTD and XML Schema: describes the structure and content of XML documents. XSLT: XSL stands for eXtensible Stylesheet Language, and is a style sheet language for

Related Documents:

2.1 XML (Extensible Markup Language) 13 2.2 XSD (XML Schema Definition) 18 2.3 MathML (Mathematical Markup Language) 23 2.4 SPS (StyleVision Power Stylesheet) 25 2.5 XSL (Extensible Style Language) 27 2.6 XSLT (Extensible Style Language Transformations) 31 2.7 XSL:FO (Extensible Style Language: Formatting Objects) 32 2.8 XPath (XML Path Language) 33 3 Estudi de l'estàndard XML DocBook 37 3.1 .

Extensible Markup Language (XML), Extensible 3D (X3D), Extensible Stylesheet Language (XSL), US Message Text Format (USMTF), XML-MTF, Land Command and Contol Information Exchange Model (LC2IEDM), Generic Hub (GH), Amphibious Raid 16. PRICE CODE 17. SECURITY Unclassified 18. SECURITY Unclassified 19. SECURITY Unclassified 20. LIMITATION OF ABSTRACT UL NSN 7540-01-280-5500 Standard Form 298 (Rev .

Data Modeling @Uber September 12, 2019 Anand Mundada, Gaurav Tungatkar. 01 Transportation Business 02 Extensible Entity Data Model Agenda. Transportation Business. Rider Vehicle Driver . Fleet Driver Car Driver Courier A Restaurant. Extensible Entity Data Model. Data Model for Entity Unique identifier Common schema shared by all customers .

Materials Science and Engineering, Mechanical Engineering, Production Engineering, Chemical Engineering, Textile Engineering, Nuclear Engineering, Electrical Engineering, Civil Engineering, other related Engineering discipline Energy Resources Engineering (ERE) The students’ academic background should be: Mechanical Power Engineering, Energy .

compliance with Annex II criteria set out in the Regulation 1025/20121 on European standardisation. XHTML stands for Extensible Hypertext Markup Language. The W3C technical specification is a reformulation of HTML4 as an application of XML. HTML (Hypertext Markup Language) is the Markup Language for formulating Web pages in the World Wide Web and XML (Extensible Markup Language) defines a set .

2. WEB SERVER APPLICATION DEVELOPMENT Figure 2 Working of CGI A. CGI and WSGI - Web Server Application Development using Python Standard Library A.1 CGI In a static web, documents (static web pages) over the web can be returned easily to the client on its request. However, dynamic web involves generating the reply on the fly based

Careers in Engineering Guide the brighter choice. Contents ABOUT LSBU 4–5 BUILDING SERVICES ENGINEERING 6–7 CHEMICAL AND PETROLEUM ENGINEERING 8–9 CIVIL ENGINEERING 10–11 ELECTRICAL AND ELECTRONIC ENGINEERING 12–13 MECHANICAL ENGINEERING 14–15 MECHATRONICS ENGINEERING 16–17 PRODUCT DESIGN ENGINEERING 18–19 An engineering degree is a big challenge to take on. There is no denying .

Grade 2 ELA Week of May 4 - May 8, 2020 Day Skill Instructions Monday Use Text Features to Location Information Efficiently Review Learning: Using Text Features Read Endangered Species: The African Elephant . Respond to the comprehension questions. Tuesday Describe the connection between ideas or concepts in a text Review Learning: Describe the Connections in a Text Reread Endangered Species .