ead lecture4 - xml and related technologies

46
XML and Related Technologies Enterprise Application Development Unit Code 425

Upload: buddhika-gamage

Post on 10-Sep-2015

214 views

Category:

Documents


1 download

DESCRIPTION

mmmmmm

TRANSCRIPT

Design Patterns with UML.ppt

XML and Related TechnologiesEnterprise Application Development Unit Code 425

XML and Related TechnologiesIFS Training IFS Applications 2003

Page #XML - Extensible Markup LanguageXML (Extensible Markup Language) is a general-purpose specification for creating custom markup languages. It is classified as an extensible language, because it allows the user to define the mark-up elements.XML is a software and hardware independent tool for carrying (store and transport) information.XML is a markup language much like HTML.Page 2XML and Related TechnologiesPage #XML - Extensible Markup LanguageXML was designed to carry data, not to display data like HTML.XML is a complement to HTML not a replacement.Page 3XML and Related TechnologiesPage #XMLXML tags are not predefined unlike in HTML. You must define your own tags.XML is designed to be self-descriptive.XML is Just Plain Text.XML does not DO anything unlike a programming language that have instructions.XML is a W3C Recommendation.http://www.w3.org/standards/xml/Reference: http://www.w3schools.com/xml/default.aspPage 4XML and Related TechnologiesPage #XML File - 1

Page 5XML and Related TechnologiesPage #XML File - 2Page 6

XML and Related TechnologiesImportance of XMLXML is a W3C recommendation.XML is now as important for the Web as HTML was to the foundation of the Web. XML is the most common tool for data transmissions between all sorts of applications.XML is becoming more and more popular in the area of storing and describing information.Page 7XML and Related TechnologiesPage #XML for Data Storage and SharingXML simplifies data storage of web applications.XML separates data from HTML.Makes it possible to display dynamic data in HTML documents without having to edit HTML every time data changes.Page 8XML and Related TechnologiesPage #XML for Data Storage and SharingWith a few lines of JavaScript, you can read an external XML file and update the data content of your HTML.XML data is stored in plain text format. This provides a software and hardware independent way of storing or transporting data.Page 9XML and Related TechnologiesPage #XML for Data Storage and SharingSo different applications can share/communicate the same data.XML being stored as simple text also makes it possible for systems to easily port into different software/hardware platforms.Page 10XML and Related TechnologiesPage #XML for Data Storage and SharingAll kinds of "reading machines" (Handheld computers, voice machines, news feeds, etc) understand XML and makes your data available to a wide variety of audience including differently-able persons.All these make your data more available and diversely useful.Page 11XML and Related TechnologiesPage #

XML for Web DevelopersPage 12XML as discussed above makes it easy is for HTML documents to display dynamic data.A lot of new Internet languages are created with XML like HTML, WSDL, RSS.

XML and Related TechnologiesPage #XML DocumentsXML documents form a tree structure that starts at "the root" and branches to "the leaves".

The 4 child elements are siblings of each other.

XML declaration: Version and Encoding Root element of document, next 4 lines are child elements End of root element/end of XML document Page 13XML and Related TechnologiesPage #XML Document Tree Structure

Page 14XML and Related TechnologiesPage #XML Syntax RulesAll XML Elements Must Have a Closing Tag.XML Tags are Case Sensitive.XML Elements Must be Properly Nested.XML Documents Must Have a Root ElementXML Attribute Values Must be Quoted

Page 15XML and Related TechnologiesPage #XML Syntax RulesUse Entity References instead of characters with a special meaning in XML.

.Page 16XML and Related TechnologiesPage #XML Syntax RulesPage 17HTML reduces multiple white space characters to a single white space but with XML, the white spaces in your document are not truncated.XML Stores New Line as LF.XML and Related TechnologiesPage #XML ElementsAn XML element is everything from (including) the element's start tag to (including) the element's end tag.An element can contain other elements, simple text or a mixture of both. Elements can also have attributes.Page 18XML and Related TechnologiesPage #XML ElementsIn the example, and have element contents, because they contain other elements. has text content because it contains text.

Also only has an attribute (category="CHILDREN").Page 19XML and Related TechnologiesPage #XML Element NamesNames can contain letters, numbers, and other charactersNames cannot start with a number or punctuation characterNames cannot start with the letter xml (or XML or Xml, etc)Names cannot contain spaces.Page 20XML and Related TechnologiesPage #XML is ExtensibleObserve the two XMLs above. A program originally written to read the one should not be crashed when the other XML is instead used as the input.Therefore the program should not read element contents by index but by element name.

Page 21XML and Related TechnologiesPage #XML AttributesXML elements can have attributes in the start tag, just like HTML.Attributes provide additional information about elements. Better be used to store data about data (metadata).XML attributes must be quoted using either single or double quotes.There are no rules about when to use attributes and when to use elements.Page 22XML and Related TechnologiesPage #XML ValidationXML with correct syntax is "Well Formed" XML.A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a Document Type Definition (DTD).

Page 23XML and Related TechnologiesPage #DTDThe purpose of a DTD is to define the structure of an XML document.

Page 24XML and Related TechnologiesPage #XML SchemaW3C supports an XML based alternative to DTD called XML Schema.

Page 25XML and Related TechnologiesPage #Displaying formatted XMLIt is possible to use CSS to format an XML document.However W3C recommend using XSLT (extensible style sheet language transformations) instead.

Page 26XML and Related TechnologiesPage #XSLT

Page 27XML and Related TechnologiesPage #XML ParserMost browsers have a built-in XML parser to read and manipulate XML.Parser converts XML into a JavaScript accessible object (XML DOM object). Page 28XML and Related TechnologiesPage #XML DOM andXMLHttpRequest ObjectPage 29XML DOM (XML Document Object Model) defines a standard way for accessing and manipulating XML documents. HTML DOM (HTML Document Object Model) defines a standard way for accessing and manipulating HTML documents. XML DOM and HTML DOM used together makes it possible to display data of XML using HTML.The XMLHttpRequest object provides a way to communicate with a server after a web page has loaded.XML and Related TechnologiesPage #XML NamespacesXML Namespaces provide a method to avoid element name conflicts.Name conflicts in XML can easily be avoided using a name prefix.

Page 30XML and Related TechnologiesPage #XML NamespacesWhen using prefixes in XML, a so-called namespace for the prefix must be defined.The namespace is defined by the xmlns attribute in the start tag of an element.Namespace describes the prefix.The namespace declaration has the following syntax. xmlns:prefix="URI.Page 31XML and Related TechnologiesPage #XML NamespacesWhen a namespace is defined for an element, all child elements with the same prefix are associated with the same namespace.The namespace URI is not used by the parser to look up information. Page 32XML and Related TechnologiesPage #XML Namespaces

Page 33XML and Related TechnologiesPage #URI (Uniform Resource Identifier)URI is a string of characters which identifies an Internet Resource. The most common URI is the Uniform Resource Locator (URL).Another, not so common type of URI is the Universal Resource Name (URN).Page 34XML and Related TechnologiesPage #Default NamespacesDefining a default namespace for an element saves us from using prefixes in all the child elements.

Page 35XML and Related TechnologiesPage #XML CDATAAll text in an XML document will be parsed by the parser.

The parser does this because XML elements can contain other elements.CDATA is used about text data that should not be parsed by the XML parser.

Page 36XML and Related TechnologiesCDATA - (Unparsed) Character DataPCDATA - Parsed Character DataPage #XML EncodingXML documents can contain non ASCII characters, like Norwegian , or French .XML Encoding may be given as follows. Always use the encoding attribute Use an editor that supports encodingPage 37XML and Related TechnologiesPage #XML EncodingMake sure you know what encoding the editor uses Use the same encoding in your encoding attributePage 38XML and Related TechnologiesPage #XML on the ServerXML files are plain text files just like HTML files.XML can easily be stored and generated by a standard web server or even database.With ASP and PHP its simply a matter of specifying that content type is text/xml.Page 39XML and Related TechnologiesPage #XML on the ServerTo generate an XML response from the server Page 40XML and Related TechnologiesPage #XML TechnologiesXHTML (Extensible HTML) A stricter and cleaner XML based version of HTML.XML DOM (XML Document Object Model)A standard document model for accessing and manipulating XML.XSL (Extensible Style Sheet Language) XSL consists of three parts:XSLT (XSL Transform) - transforms XML into other formats, like HTMLXSL-FO (XSL Formatting Objects)- for formatting XML to screen, paper, etcXPath - a language for navigating XML documents Page 41XML and Related TechnologiesPage #XML TechnologiesXQuery (XML Query Language)An XML based language for querying XML data.DTD (Document Type Definition)A standard for defining the legal elements in an XML document.XSD (XML Schema)An XML-based alternative to DTD.XLink (XML Linking Language)A language for creating hyperlinks in XML documents.XPointer (XML Pointer Language)Allows the XLink hyperlinks to point to more specific parts in the XML document. Page 42XML and Related TechnologiesPage #XML TechnologiesSOAP (Simple Object Access Protocol)An XML-based protocol to let applications exchange information over HTTP.WSDL (Web Services Description Language)An XML-based language for describing web services.RDF (Resource Description Framework)An XML-based language for describing web resources.RSS (Really Simple Syndication)A format for syndicating news and the content of news-like sites.Page 43XML and Related TechnologiesPage #XML TechnologiesXForms (XML Forms) Uses XML to define form data.WAP (Wireless Application Protocol)A XML based language for displaying content on wireless clients, like mobile phones.SMIL (Synchronized Multimedia Integration Language)A language for describing audiovisual presentations.SVG (Scalable Vector Graphics) Defines graphics in XML format.

Page 44XML and Related TechnologiesPage #XML EditorsProfessional XML editors will help you to write error-free XML documents.Validate your XML against a DTD or a schema.Force you to stick to a valid XML structure.A popular XML Editor is Altova XMLSpy.Page 45XML and Related TechnologiesPage #SOAPReference: http://www.w3schools.com/soap/default.aspWSDLReference: http://www.w3schools.com/wsdl/default.aspXSLReference: http://www.w3schools.com/xsl/default.aspPage 46XML and Related TechnologiesPage #