730 likes | 899 Views
XML & Java for DotCOM. Raymond Gao E-Commerce Architect DotCOM Practice Sun Microsystems, Inc. About Me:. Published Work: eAI Journal, December Edition, 2000 - "JMS: A Portable Framework for Connecting the Enterprise"
E N D
XML & Java for DotCOM Raymond Gao E-Commerce Architect DotCOM Practice Sun Microsystems, Inc.
About Me: • Published Work: • eAI Journal, December Edition, 2000 - "JMS: A Portable Framework for Connecting the Enterprise" • Enterprise Linux Journal, December, 2000 (2nd Cover) - "Java on Linux, A Clear Choice for Open Source Technology" (Guest Editor) • Speaking Engagments: • "XML and Java for DotCom" - Java Plus 2000 Conference, San Jose, CA
Introduction The Network is the Computer
The Internet Phenomenon • As of 2000, the global online population is > 400 Million people. • 38 Years to get 300 Million Radio Listeners • 15 Years for TV viewers • By 2004, Worldwide Net-Commerce spending will apprach $6.8 trillion. source: Forrester Research
Internet Means Big Business • By 2004, the worldwide market for packaged E-Commerce software will reach $14.5 billion. (source: IDC) • The J2EE Advantage Art Technology, IBM, Oracle, BEA Software, etc. • Marketing XML and Open Source Technologies
Internet Is Changing the World Internet has fundamentally altered the business landscape and transformed the global business into a giant borderless exchange with information valued as the currency. JMS: A Portable Framework for Connecting the Enterprise eAI-Journal, December 2000
Computing In The Age Of Internet • Portable Technology & Open/Non-proprietary technology. • Pluggable and reusable modules. • The 4As and 8-abilities. • Anytime, Anywhere, Any device, and AnyOne • Scalability, Availability, Manageability, Compatibility, Security, Stability, Portability, and Flexibility.
The Next Generation Internet • Wireless Internet Access Devices will become pervasive • By 2002, there will be 1.3 billion subscribers of wireless internet capable devices (source: IDC) • A plethora of Wireless Devices: internet applicances, gaming, TV, household, etc. • AOL had 1.5 million subscriber in 1994. • The Rise of Web Agent Technology • Scalability and Inter-Operability
Some Examples Of Next Generation Internet Devices TV and Audio/Video PDAs Cell Phones Automobiles Pagers Trading Partner's Server
What're The Ramifications? • The old HTML server model will become OBSOLETE. • Emergance of new Technology and Standards. • SOAP, UDDI, IIOP, J2EE, SVG, ebXML, etc • Open source Technology will play even greater roles • Linux, Apache, Tomcat, etc. • GNOME and Solaris
The HTML Server Model In the HTML Server Model, content is presented in the HTML format. It cannot service non-HTML clients.
Why HTML Server Model Won't Work • HTML tag set is inflexible. • Tag’s semantics cannot be changed • Data structure is lost during the HTML translation process • Data validation is not supported i.e. broken <a href > links • Hard to interface with the app-logic • HTML document cannot be directly mapped backend to a database
Some Symptoms • Broken links. • NO support for PDAs and Wireless devices. • Difficult to find useful information • 4 Billion pages by January - only 0.01% is useful for a person (USA Today, July 11)
XML’s Philosophy XML derives from the philosophy that data belongs to its creators and that content providers are best served by data format that does not bind them to any particular script languages, authoring tools, and delivery engines but provides a standardized, vendor-independent, level playing field… Jon Bosak “XML, Java, and the Future of the Web”
XML-Info Server Model A Better Approach
What Is XML? • eXtensible Markup metaLanguage • A method for structuring portable data • A subset of SGML (ISO 8879) • A meta-language - supports unlimited numbers of context-relevant tags and attribute names. • The current version of XML 1.0 is in proposed recommendation stage as of 1/19/2001.
What Makes XML The Ideal Data Format • Extensible - Allowing user to define new tags and schemas (DTD) that are context-relevant • Reusable - Switching between different views without the need for new downloads • Structured - Providing a hierarchical model that facilitates Object-Orient Programming and resembles the database • Validation & well formed - Content and syntax checking
Plan of Presentation XML portion • XML Review • Syntax & Rules • DTD • XSL and the rest (There will a quiz?) • 3-Tiered XML Model • How XML relates to Java
General Rules About XML • XML is case sensitive. • All XML documents must begin with the prolog • <?xml version = “1.0”?> Correct • <?XML version = “1.0”?> Incorrect • XML must be Well-Formed - A document that is not well-formed is not XML. • Can use optional DTD for document validation.
Well-Formed Rules for XML Elements • Must have explicit starting and ending tags for every elements including empty tags. • <tag>text</tag> or <tag/> Correct • <stuff><tag-a>words</stuff> Incorrect • All XML document can have only one root element (/). • No element overlap allowed. • <a>A<b>B</a></b>
Well-Formed Rules for XML Attributes • Space(s) is used as the separator, no comma and period. <apple color=“red” taste=“sweet”> Correct <apple_color=“green”,taste=“sour”> Incorrect • Each attribute must have a valid name. <apple color=“” taste=“sweet”> Correct <apple “green” the taste=“sour”> Incorrect • Equal-sign and quotes are required.
An Example of Well-Formed XML Document <?xml version=“1.0” standalone=“no” ?> <!DOCTYPE play SYSTEM “play.dtd”> <play location = “Broadway”> <playname> Hamlet </playname> <author> Shakespare </author> <type> Tragedy </type> </play>
DTD Syntax(Document Type Declaration) • How to Link DTD to your XML document • How to declare an XML element in the DTD • How to add attribute(s) to an XML element in the DTD
Linking DTD To An XML Document • Using an external DTD: <?xml version=“1.0”standalone=“no” ?> <!DOCTYPE mydtd SYSTEM “MY.DTD”> ... ... Rest of your XML document ... • Using an internal DTD: <?xml version=“1.0”standalone=“yes” ?> <!DOCTYPE mydtd [... internal DTD ...]> ... ... Rest of your XML document ...
Declaring An XML Element • Syntax: <!ELEMENT name (content model) > • Special Symbols: ? Zero or One + One of More * Zero or more #PCDATA Character data • Example <!ELEMENT play (playname, author, type?)> <!ELEMENT playname (#PCDATA)>
Adding Attribute(s) • If the XML element is the noun, then the XML attribute is the adjective. • Syntax: <!ATTLIST element_name attribute value default_value> • Example: • <!ELEMENT play (playname, author, type?)> <!ATTLIST play date CDATA #IMPLIED location CDATA #REQUIRED time (weekday | weekend) “weekend”>
An Example DTD <!-- This is the DTD for the play example --> <!ELEMENT play (playname, author, type?)> <!ATTLIST play date CDATA #IMPLIED location CDATA #REQUIRED time (weekday | weekend) “weekend”> <!-- Information about a play --> <!ELEMENT playname (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT type (Tragedy | Comedy | Drama)>
XSL (eXtensible StyleSheet Layout) • XSL is itself a XML document. • XSL has two parts: 1. XSLT - XML Transformation. Takes an XML document and outputs into a HTML, WML, or XML document. (now in W3C version 1.1 working draft) 2. XSLFO - XML formatting. XML equivalent of CSS (Cascading StyleSheet)
Justification For Using 3-Tier Architecture • Scalable - Difficult to forecast web-site load & dynamic system capacity adjustment according to demand • Adaptable - Business process can change • Reusable - Component architecture • Maintenance & Improvement • Cycle Time & Cost
Why Use 3-Tier Architecture For XML Programming • Model after MVC (Model, View, Controller). • Make better architecture sense. • More adaptable - evolve according to changes in the business process. • Integrate with other languages - Java, UML, C++. (S/W Methodolgy) • Distributed Computing. • Increase portability.
What Are The 3 XML Tiers? • Content • Interchange • Structure
The Content Tier • Purpose: contain the “instance” information about the data to be consumed by the end-user. • Usage: Holds the actual data content. • Examples: XML, WML, and XHTML documents.
The Structure Tier • Purpose: hold the schema information about a group of XML document(s). • Usage: abstract & high-level. i.e. for document validation and binds to the content. • Examples: DTD, XML Schema, RDF, Namespaces, ebXML, SOAP, fpML, JSP spec, etc.
The Interchange Tier • Purpose - formatting & translating the XML data into appropriate views for the end-user’s application and connecting XML documents. • Usage: Displaying appropriate view, linking, and transforming documents, etc. • Examples: XSL, XSLT, XPath, XFormat, XPointer, XLink.
Some Useful Websites Related to XML • http://www.xml.com • http://www.xmlinfo.com • http://www.oasis-open.org/Cover/ • http://www.wrox.com • http://www.w3.org/XML/ • http://www.javasoft.com/XML • http://www.w3.org/XML/Schema
Why XML Needs Java • XML is data; and data does not have behaviors • XML has no legs - XML did not specify which transport protocol to use • XML presentation is dependent on the OS platform - different platforms use different encoding schemes <CR><LF> on unix, dos, & mac • Security & Lifecycle - Schema will evolve
Software Engineering Meets Business Domain • Can you buy a car with a Java object? - Exchange Java objects can be inefficient • The world is not made up entirely of JVMs - Legacy applications, native code programs, … • Distributed computing & security • Send messages that everyone can understand
Java And XML Are Complementary Technology • Portable data; Portable code • N-Tier architecture • Distributed computing • Security model • Growth of the smart internet - agent technology • Realization for wireless devices • Programming concept vs. computing in the real world
Is Your Application Portable? • True && False => False (XML + native code) • False && True => False (HTML + Java) • True && True => True (XML + Java)
How XML fits into the Java Framework • Established Standards: • EJB already uses XML for deployment descriptor (DD). • JSP offers Tag library - observes XML convention, (Pipelines.) • JMS (Java Message Service) • Upcoming Technology: • EJB 2.0 and asynchronous transaction. • JAXP, JAXM, XMI, ...