Component-based Software Engineering: XML Matthijs van der Zon Fall 2003
Recapitulation Part One Part Two Part Three Motivation – components and markets Part Two Foundation Part Three Component models and platforms 16/10/2003 XML
Overview “Wiring” standards Rise of XML Difference with markup languages Structure of XML SOAP (simple object acces protocol) Web services 16/10/2003 XML
Object and component “wiring” standards One standard All components connectable Never been achieved Phone jacks Electronical sockets 16/10/2003 XML
On the wire – the rise of XML Introduced in 1998 By W3C (Worldwide Web Consortium) eXtensible Markup Language Succeeded where others failed: Intresting properties Standardization Proper timing 16/10/2003 XML
Properties of XML Define own markup Useful for representing data Structured Semistructerd Not useful for bulk data New applications arise by day Browsers support displaying XML documents Syntactic lingua franca (common language) 16/10/2003 XML
Qualifier eXtensible Extensibility: Simple syntax Namespaces Safely ignorance Leading “X” to all the acronyms in the XML family XML Documents XML Namespaces XML Schemas Etc. 16/10/2003 XML
Structure of HTML Example: <HTML> <HEAD> <TITLE>Hello From HTML</TITLE> </HEAD> <BODY> <CENTER> <H1> Hello From HTML </H1> </CENTER> Welcome to the wild and woolly world of HTML. </BODY> </HTML> 16/10/2003 XML
Relationship between HTML and XML Both based on SGML Standard Generalized Markup Language Both uses elements and attributes 16/10/2003 XML
Disadvantages of HTML and other markup languages Provides not enough power Only web pages Consists of fixed number of tags HTML 4.0 about 100 to 120 Easy abounds by specifying how content of document is handled See RTF example 16/10/2003 XML
Structure of XML XML elements XML attributes Unstructured text <tags> XML attributes Parameters of elements Unstructured text Properly quoted Example: <tag attr1=“val1” attr2=“val2”> 16/10/2003 XML
XML example <?xml version="1.0" encoding="UTF-8"?> <DOCUMENT> <GREETING> Hello From XML </GREETING> <MESSAGE> Welcome to the wild and woolly world of XML </MESSAGE> </DOCUMENT> 16/10/2003 XML
Well-Formed XML Documents Elements that can appear at top level Set of valid attributes Default value if attribute is omitted Allowed number of appearances Allowed to contain unstructured text (“CDATA”) 16/10/2003 XML
Valid XML Documents Check document is well formed Document type definition (DTD) DTD specifies the correct syntax is not extensible XML validator Example: <!DOCTYPE DOCUMENT [ <!ELEMENT DOCUMENT (GREETING, MESSAGE)> <!ELEMENT GREETING (#PCDATA)> <!ELEMENT MESSAGE (#PCDATA)> ]> 16/10/2003 XML
XML Schemas More precise than DTD Example specify the actual data types use schemas with multiple namespaces create simple and complex data types create list types and much more Example <DOCUMENT xmlns="x-schema:schema1.xml"> schema1.xml 16/10/2003 XML
XML Namespaces Grouping set of names Prevents tag collision Example xmlns:alias”<urn>” (universal resource name) 16/10/2003 XML
XML Namespaces (example 1.1) <library xmlns:book="http://www.amazingterrificbooks.com/spec"> <book> <title> Earthquakes for Lunch. </title> </book> </library> 16/10/2003 XML
XML Namespaces (example 1.2) <book:library xmlns:book="http://www.amazingterrificbooks.com/spec"> <book:book> <book:title> Earthquakes for Lunch. </book:title> </book:book> </book:library> 16/10/2003 XML
SOAP (simple object access protocol) Describe addressee of an invocation Encode data types into invocation messages Define what parts of a message must be understood or can be ignored 16/10/2003 XML
SOAP example <SOAP-ENV:Envelope> <SOAP-ENV:Body> <xmlns:n=http://schemas.example.com/customer/> <n:getName> <n:customerID id=“123-321”/> </n:getName> </SOAP-ENV:Body> </SOAP-ENV:Envelope> 16/10/2003 XML
XML web services Offers computational services Examples: WSDL (Web Services Description Language) UDDI (Universal Description, Discovery, and Integration WSFL (Web Service Flow Language) 16/10/2003 XML
Which way? Three major approaches The OMG: CORBA The Sun way: Java, JavaBeans The Microsoft way: COM, .NET Web standards intergrates all families 16/10/2003 XML