SlideShare a Scribd company logo
1 of 34
Download to read offline
XML and Java:
Lessons Learned in Building
       Application


           Ted Leung
  Technical Lead, XML4J Parser
Agenda

Technology background
  XML
  Java
Architectures
Guidelines
XML Tools
Summary
Distributed OO Middlewar

   Java                                      XML
Portable Programs                          Portable Data




                      Open
                    Standards




             Distributed Object Infrastructure

                    CORBA
                                                           IP Network
                                    Pervasive Networks
XML - eXtensible Markup Language

XML was derived from SGML
  80% of function, 20% of complexity
XML is key for e-business
  standard way to share structured data
XML and Java work well together
  Java = portable code
  XML = portable data
XML says nothing about presentation
XML example - Address Book

Address Book Markup Language sample

<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>

<!DOCTYPE addressBook SYSTEM quot;abml.dtdquot;>

<addressBook>
  <person salary=quot;26350.00quot; band=quot;Dquot;>
    <name>
      <family>Wallace</family> <given>Bob</given>
    </name>
    <email>bwallace@megacorp.com</email>
  </person>
</addressBook>
Document Type Description
DTD Example for Address Book
<?xml encoding=quot;UTF-8quot;?>
<!ELEMENT addressBook (person)+>
<!ELEMENT person (name,email*)>

<!ATTLIST person salary CDATA #REQUIRED >
<!ATTLIST person band (A|B|C|D|E|F) #REQUIRED >
<!ATTLIST person active (true|false) quot;truequot;
#IMPLIED >

<!ELEMENT   name (family, given)>
<!ELEMENT   family (#PCDATA)>
<!ELEMENT   given (#PCDATA)>
<!ELEMENT   email (#PCDATA)>
A Sampling of DTDs

Open Financial            Bean Markup Language
Exchange (OFX)            (BML)
Online Trading Protocol   Translation Memory
(OTP)                     eXchange (TMX)
Information and Content   Mathematical Markup
Exchange (ICE)            Language (MathML)
XML Bookmark              Scalable Vector Graphics
Exchange Language         (SVG)
(XBEL)                    Astronomical Markup
Channel Definition        Language (AML)
Format (CDF)              Biopolymer Markup
XML Remote Procedure      Language (BIOML)
Call (XML-RPC)            Common Business Library
Wireless Markup           (CBL)
Language (WML)            Extensible Logfile Format
Resource Description      (XLF)
XSLT / XSL

XSL = eXtesnbile Stylesheet Language
XSL is an XML to XML transformation system
  There are two parts
  XSLT is the tree transformation part of the language
  Formatting Objects
The transformation is declaratively specified in XML
A big use of XSL is to convert XML to HTML
Still in working draft stage
  Being combined with XPointer
XSLT Example
<?xml version=quot;1.0quot; encoding=quot;US-ASCIIquot;?>
<xsl:stylesheet xmlns:xsl=quot;http://www.w3.org/XSL/Transform/1.0quot;>
<xsl:template match=quot;personquot;>
  <html><body>
   <xsl:apply-templates/>
  </body></html>
</xsl:template>
<xsl:template match=quot;namequot;> <!-- reverse given & family name -->
  <xsl:value-of select='given'/>
  <xsl:text> </xsl:text>
  <xsl:value-of select='family'/>
</xsl:template>
<xsl:template match=quot;emailquot;>
  <a>
   <xsl:attribute name=quot;hrefquot;> <!-- add an href attribute -->
      <xsl:text>mailto:</xsl:text>
      <xsl:apply-templates/>
    </xsl:attribute>
   <xsl:apply-templates/>
  </a>
</xsl:template>
</xsl:stylesheet>
XSLT Result


<html>
  <body>
    Bob Wallace
    <a href=quot;mailto:bwallace@megacorp.comquot;>
     bwallace@megacorp.com
    </a>
  </body>
</html>
XML Schema

A richer language for constraining XML content
Syntax is regular XML syntax, not DTD syntax
Support for data typing, inheritance, namespaces
Still in early Working Draft form
XML Schema Example
<?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
<!DOCTYPE schema PUBLIC quot;-//W3C/DTD XML Schema Version 1.0//ENquot;
quot;http://www.w3.org/1999/05/06-xmlschema-1/structures.dtdquot;>
<schema>
  <elementType name=quot;addressBookquot;>
    <elementTypeRef name=quot;personquot; minOccur=quot;1quot;></elementTypeRef></elementType>
  <elementType name=quot;personquot;>
    <sequence occurs=quot;1quot;>
      <elementTypeRef name=quot;namequot; minOccur=quot;1quot; maxOccur=quot;1quot;></elementTypeRef>
      <elementTypeRef name=quot;emailquot; minOccur=quot;0quot;></elementTypeRef></sequence>
    <attrDecl name=quot;bandquot; required=quot;truequot;>
      <datatypeRef name=quot;NMTOKENquot;>
        <enumeration>
          <literal>A</literal>
          <literal>B</literal>
          <literal>C</literal></enumeration></datatypeRef></attrDecl>
    <attrDecl name=quot;activequot;>
      <datatypeRef name=quot;NMTOKENquot;>
        <enumeration>
          <literal>true</literal>
          <literal>false</literal></enumeration>
        <default>true</default></datatypeRef></attrDecl></elementType>
  <elementType name=quot;namequot;>
    <sequence occurs=quot;1quot;>
      <elementTypeRef name=quot;familyquot; minOccur=quot;1quot; maxOccur=quot;1quot;></elementTypeRef>
      <elementTypeRef name=quot;givenquot; minOccur=quot;1quot;
                maxOccur=quot;1quot;></elementTypeRef></sequence></elementType>
   </elementType></schema>
Must I use Java to use XML?

NO!!!
While many of the best programming tools for XML are
currently Java-based, XML is completely language neutral
XML is about system-to-system interaction and
component-to-component collaboration, regardless of the
underlying programming technology
Servlets
Servlet is a Java class that can be used to dynamically extend
your server's function. Servlets, as defined by Sun, are:



          quot;... objects which conform to a specific interface
         that can be plugged into a Java-based server.
         Servlets are similar to applets in that they are object
         byte codes that can be dynamically loaded off the
         net....
         They serve as platform independent, dynamically
         loadable, plugable helper byte-code objects on the
         server side....quot;



In short, a servlet is to the server what the applet is to the client
browser.

Servlets have a standard interface, which is defined in the
package javax.servlet.
What XML and Java are Not

A silver bullet
  still have to design, code, and test
Guaranteed communication
  agreement between vendors and users is still required
Not an Object-Oriented Modeling Language
  use UML/XMI for that
Not middleware
  used to develop robust middleware
A replacement for HTML
Java + XML - The Winning Team

                                               Application
 Client               Gateway                                            Resource Managers
                                                Server
                                                                                         DB2
                                                                                       EJBs and
                                                                                     stored procs.
                            Servlet                 Enterprise
  Applet
                                                                        s
                                                                     msg
                          JavaBeans                 JavaBeans
JavaBeans
                                                                 XML                 XML & SQL
                                                                                     stored data
                                      XML msgs
            XML msgs                                               via IIOP or
                                                                   MQ or IPC
                                      via IIOP or
            via HTTP or                                             XM
                                                                      Lm
                                      MQ or IPC
            IIOP or MQ
                                                                                      CICS
                                                                        sg
                                                                          s
                                                                                    EJBs and
Standard                                                                            CICS trans.
Browser




                                                                        XM
                                                                                    XML & VSAM
XML




                                                                          Lm
                                                                                    stored data
Enabled




                                                                            sg
Browser




                                                                              s
                                                                                      Domino
                                                                                     EJBs and
                                                                                    Java agents
Applications = Programs + Data                                                      XML & forms
                                                                                    stored data
Architectures using Servlets and
                 XML

We will discuss some architectures which combine use of
servlet and XML.
The application server which the servlet interacts with
could be an EJB server; a database with or without Java
stored procedures; MQSeries; CICS;etc.
We will present design considerations based on work we
have done with customers when designing servlets and
XML.
   special focus on supporting business objects
HTML/XML/DB Architecture
              HTML -> servlet -> XML -> Query (SQL) -> DB
              HTML <- XSL <- XML <- JDBC result set <- DB
                                                                                                        RDB
                                                  Java Application Server
    Browser
                                                                                                        Server
                                                 WebServer + Servlet Engine
Displays initial     servlet




                                                            transform HTML
HTML page




                                                                                XML converted
                                                                                into SQL query
                                                                                JDBC is called
                     calls




                                                           input into XML
                                      Servlets
                     using
HTML form
                     HTTP
action
calls a servlet
                                                                                                 JDBC
 <FORM METHOD=
 POST ACTION=
 quot;/servlet/GetDataServletquot;>                                XML4J Parser
                                          HTML generator




 HTML page             HTML
                                                                             converted into
                                                                             JDBC results
 showing the
 results of the
                                          using XSL




 query
                                                                             XML


                               XSL
                               file
An Example Application Problem

Client Requirements
  support an applet client for Intranet users
  support a thin HTML client for Internet users
  support interfaces to third-party applications
Complex business logic
  business objects to be used on server and in applet
Security
  authentication and single logon
  SSL encryption
Scalability using multiple servers and tiers
Server to access data in a relational database
  Note: other types of backends could be use instead of RDB
Applet to Java Server using RMI
                    (no XML)
                                           Applet <-> RMI <-> servlet
      Client Browser                                                 Java Application Server                                                RDB
       Java Applet                                                       (no webserver)                                                     Server


                                            Java




                                                                                                    Infrastructure to DB - creates
                                            Remote




                                                         RMI skeletons and RMI
                                            Method
                                            Invocation
          Business Objects




                                                                                                                                     JDBC
                                            over




                                                                                 Business Objects



                                                                                                    the busines objects
                                            sockets
                             RMI stubs
GUI




                                           Java
                                                         Objects
                                           serialized
                                           objects
                                           are sent



                                           RMI calls
                                         Third-party applications
                                RMI Skeletons and RMI Objects
Applet to Servlet Architecture
                                                         using XML
               applet <-> bus objects <-> XML <-> servlet <-> bus objects
                        Client Browser                                           Java Application Server                                               RDB
                         Java Applet                                            WebServer + Servlet Engine                                             Server
                                                                   servlet
                          toXML                                                            toXML
                                                                   calls




                                                                                                               Infrastructure to DB - creates
                                                                   using
Java GUI (AWT, Swing)




                                                                   HTTP
                                                                   passing




                                                                                            Business Objects
                                                                   XML
                            Business Objects




                                                                                                                                                JDBC
                                                 Servlet Callers




                                                                                                               the busines objects
                                                                                Servlets

                                                                   XML
                                                                   returned



                                                                              Customized
                                Customized
                                                                              XML 4Java
                                XML 4Java
                                                                              Parser using
                                Parser using
                                                                              SAX API
                                SAX API
Third-party to Servlet Architecture
                 using XML
 Third-party application <-> XML <-> servlet <-> bus objects
                                  Java Application Server
  Third-Party                                                                                       RDB
                                 WebServer + Servlet Engine
  Application                                                                                       Server
                  servlet
                                         toXML
                  calls




                                                            Infrastructure to DB - creates
Application in    using
                  HTTP
any language
                  passing
                  XML




                                         Business Objects
                                                                                             JDBC
XML parser to




                                                            the busines objects
                              Servlets
xxx language
servlet callers
                  XML
      or          returned

  into a RDB

     or                      Customized
                             XML 4Java
transformed to
                             Parser using
 HTML
                             SAX API
Potential Benefits using XML and
           Servlets Together
Leverage webserver technology for provide security
   single logon
   servlet security
   SSL is very simple
Highly scaleable using webserver and load balancing
technology
Integration into a large website is simplified
Provide distinct, flexible interface the application servers
   between application components
   for 3rd party
Support multiple front-ends
   transform results from XML to HTML using XSL
   3rd applications written in any language can call the
   servlets and receive XML
   queuing of messages is easily supported
   XML rendered directly in the browser
Design Choices - XML
Non-technical considerations
  cooperation in industry (suppliers, consumers)
  competitive advantage
  dominant players may dictate
When to use DTD validation
  better performance without validation
  turn off when system is closed, turn on for third-party use
XML type definition is limited to Strings
  modeling work is required to map objects or tables
Consider XML namespace issues
To transform business objects to XML requires custom
code
Storing XML into a RDB
  map from flat text structure to relational tables
  map from business object to relational tables
  store XML into text extenders
  more direct support for XML is coming
Design Choices - DOM vs SAX
     wrt XML <-> Busines Objects
 Both DOM and SAX being widely supported and standardized

       DOM                               SAX
                                API oriented mechanism
Creates a Document
                                which is triggered by XML
Object Model tree.
                                tags
DOM tree which must be
                                Calls handler when XML
reparsed and converted
                                tag is read
into business objects.
DOM tree is not really          Generates events without
used.                           the DOM tree
Need to subclass                Code is straightforward
business objects from
DOM superclass
Subclassing DOM parser
is more complex code.
Design Choices - DTD Specification
Designed to support generalization
Simple instance data represented as attributes instead of
sub-elements
  performance tradeoff vs richness of information
Inheritance
  XML's flat structure does not provide any inherent support
  for inheritance
  superclass attributes included in the DTD for every concrete
  subclass
Relationships represented as generalized 'Association
elements'
  <!ELEMENT Association EMPTY >
     <!ATTLIST Association
        name          CDATA #REQUIRED
        multiplicity   (1..1|1..n|n..m) #REQUIRED
        oids         CDATA #REQUIRED
     >
  No contained objects are defined in the DTD
  Linked to lazy initialization of relationships
Design Choices - Servlets

Calls to servlets serve as API calls into the Java Server
  'command' and parameters can be included as a parameter of
  the servlet
    ex. VehicleServlet?command=retrieve&oid=1234567
    basic validation of commands
  represent the APIs in the XML which is passed to the servlet
Servlet design
  Single command processor servlet
  Seperate servlet for each set of related commands such as
  CRUD for a business object
  Seperate servlet for each command
Handle required parameter information versus optional
information
  API should be 'forgiving'
    i.e. able to handle unexpected information and lack of optional
    information
Guidelines for Development
                Process
Get help/input from business people
Model the business objects and DTD separately
  want your DTD to be application independent
  DTD should be designed independently of a data or object
  model
    but with consideration of the databases and applications to be
    supported
    i.e. start from a purist view and compromise
  map between the business objects, database, and XML as
  needed
Validate DTD with business people and third-parties
  keep it simple where possible
prototype, prototype, prototype
  measure performance
search for existing solutions and tools
  XML and Java tool space moves quickly
XML Architectures
        (future is coming quickly)
XML directly in and out of DB2
  HTML -> servlet -> XML -> DB2
  DB2 -> XML -> XSL processing servlet -> HTML
XML transformed by MQ
XML directly rendered in a browser
  using XSL
XML used with MQ Integrator to communicate between
business or systems
XML with Java Messaging Service (JMS)
XML provides configuration information for systems
XML Tools

Changing drastically / quickly
Standards are moving quickly, tools keeping up
Java is preferred development language
  Unicode support
Tool Categories
  XML Parsers
  Database support
  Messaging product support
  XML Editors
  XSL Processors
  Java class libraries
    digital signature
    visual beans
IBM XML Tools

Available from Alphaworks (www.alphaworks.ibm.com)
  XML Parser for Java (XML4J)
  Lotus XSL
  XML Productivity Kit for Java
  XML Security Suite
  Xeena
  Bean Markup Language
  P3P
  XML Diff and Merge, XML TreeDiff
  XML Parser for C++
WebSphere
MQ Series
DB2
External IBM XML Website



                       fo
                     in
                   L
                  M
                fX
               o
            ce
           r
         ou
       ts
     es
   rb
 ou
Y
DEMO
Resources
Useful Sites
  www.ibm.com/xml
  www.ibm.com/java
  www.alphaworks.ibm.com
  www.xml.com
  www.xml.org
Contacts
  xml4j@us.ibm.com

More Related Content

What's hot (8)

Building Asynchronous Services With Sca
Building Asynchronous Services With ScaBuilding Asynchronous Services With Sca
Building Asynchronous Services With Sca
 
Data Aggregation System
Data Aggregation SystemData Aggregation System
Data Aggregation System
 
MongoDB at the energy frontier
MongoDB at the energy frontierMongoDB at the energy frontier
MongoDB at the energy frontier
 
Transformation of Java Server Pages: A Modern Approach
Transformation of Java Server Pages: A Modern ApproachTransformation of Java Server Pages: A Modern Approach
Transformation of Java Server Pages: A Modern Approach
 
Unit 5-jdbc2
Unit 5-jdbc2Unit 5-jdbc2
Unit 5-jdbc2
 
WEB TECHNOLOGIES JSP
WEB TECHNOLOGIES  JSPWEB TECHNOLOGIES  JSP
WEB TECHNOLOGIES JSP
 
The Crosswalk Web Service
The Crosswalk Web ServiceThe Crosswalk Web Service
The Crosswalk Web Service
 
exchange2010-Architecture
exchange2010-Architectureexchange2010-Architecture
exchange2010-Architecture
 

Similar to XML and Java Lessons

XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7Deniz Kılınç
 
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013Charles Moulliard
 
Hummingbird - Open Source for Small Satellites - GSAW 2012
Hummingbird - Open Source for Small Satellites - GSAW 2012Hummingbird - Open Source for Small Satellites - GSAW 2012
Hummingbird - Open Source for Small Satellites - GSAW 2012Logica_hummingbird
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Marco Gralike
 
Java Framework for Database-Centric Web Engineering
Java Framework for Database-Centric Web EngineeringJava Framework for Database-Centric Web Engineering
Java Framework for Database-Centric Web EngineeringBeat Signer
 
Java Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationJava Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationIMC Institute
 
Visualizing content in metadata stores
Visualizing content in metadata storesVisualizing content in metadata stores
Visualizing content in metadata storesXavier Llorà
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons          Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons Provectus
 
Apache Camel: The Swiss Army Knife of Open Source Integration
Apache Camel: The Swiss Army Knife of Open Source IntegrationApache Camel: The Swiss Army Knife of Open Source Integration
Apache Camel: The Swiss Army Knife of Open Source Integrationprajods
 
J2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenJ2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenlissa cidhi
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1Marco Gralike
 
Semantic RDF based integration framework for heterogeneous XML data sources
Semantic RDF based integration framework for heterogeneous XML data sourcesSemantic RDF based integration framework for heterogeneous XML data sources
Semantic RDF based integration framework for heterogeneous XML data sourcesDeniz Kılınç
 
XML Schema Patterns for Databinding
XML Schema Patterns for DatabindingXML Schema Patterns for Databinding
XML Schema Patterns for DatabindingPaul Downey
 
Java one 2010
Java one 2010Java one 2010
Java one 2010scdn
 

Similar to XML and Java Lessons (20)

XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7XML, XML Databases and MPEG-7
XML, XML Databases and MPEG-7
 
Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013Make easier Integration of your services with Fuse Solutions - RedHat 2013
Make easier Integration of your services with Fuse Solutions - RedHat 2013
 
Hummingbird - Open Source for Small Satellites - GSAW 2012
Hummingbird - Open Source for Small Satellites - GSAW 2012Hummingbird - Open Source for Small Satellites - GSAW 2012
Hummingbird - Open Source for Small Satellites - GSAW 2012
 
Ra business intelligence 0.1
Ra business intelligence 0.1Ra business intelligence 0.1
Ra business intelligence 0.1
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
C:\fakepath\jsp01
C:\fakepath\jsp01C:\fakepath\jsp01
C:\fakepath\jsp01
 
Java Framework for Database-Centric Web Engineering
Java Framework for Database-Centric Web EngineeringJava Framework for Database-Centric Web Engineering
Java Framework for Database-Centric Web Engineering
 
Obiee 11 g
Obiee 11 gObiee 11 g
Obiee 11 g
 
Java Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationJava Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web Application
 
Riding with camel
Riding with camelRiding with camel
Riding with camel
 
8023.ppt
8023.ppt8023.ppt
8023.ppt
 
Visualizing content in metadata stores
Visualizing content in metadata storesVisualizing content in metadata stores
Visualizing content in metadata stores
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons          Using Apache Spark as ETL engine. Pros and Cons
Using Apache Spark as ETL engine. Pros and Cons
 
Apache Camel: The Swiss Army Knife of Open Source Integration
Apache Camel: The Swiss Army Knife of Open Source IntegrationApache Camel: The Swiss Army Knife of Open Source Integration
Apache Camel: The Swiss Army Knife of Open Source Integration
 
J2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenJ2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for women
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
 
Semantic RDF based integration framework for heterogeneous XML data sources
Semantic RDF based integration framework for heterogeneous XML data sourcesSemantic RDF based integration framework for heterogeneous XML data sources
Semantic RDF based integration framework for heterogeneous XML data sources
 
XML Schema Patterns for Databinding
XML Schema Patterns for DatabindingXML Schema Patterns for Databinding
XML Schema Patterns for Databinding
 
Java one 2010
Java one 2010Java one 2010
Java one 2010
 

More from Ted Leung

DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 KeynoteTed Leung
 
A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency ConstructsTed Leung
 
Seeding The Cloud
Seeding The CloudSeeding The Cloud
Seeding The CloudTed Leung
 
Programming Languages For The Cloud
Programming Languages For The CloudProgramming Languages For The Cloud
Programming Languages For The CloudTed Leung
 
MySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQLMySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQLTed Leung
 
PyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for PythonPyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for PythonTed Leung
 
Northwest Python Day 2009
Northwest Python Day 2009Northwest Python Day 2009
Northwest Python Day 2009Ted Leung
 
PyCon UK 2008: Challenges for Dynamic Languages
PyCon UK 2008: Challenges for Dynamic LanguagesPyCon UK 2008: Challenges for Dynamic Languages
PyCon UK 2008: Challenges for Dynamic LanguagesTed Leung
 
OSCON 2008: Open Source Community Antipatterns
OSCON 2008: Open Source Community AntipatternsOSCON 2008: Open Source Community Antipatterns
OSCON 2008: Open Source Community AntipatternsTed Leung
 
OSCON 2007: Open Design, Not By Committee
OSCON 2007: Open Design, Not By CommitteeOSCON 2007: Open Design, Not By Committee
OSCON 2007: Open Design, Not By CommitteeTed Leung
 
Ignite The Web 2007
Ignite The Web 2007Ignite The Web 2007
Ignite The Web 2007Ted Leung
 
ApacheCon US 2007: Open Source Community Antipatterns
ApacheCon US 2007:  Open Source Community AntipatternsApacheCon US 2007:  Open Source Community Antipatterns
ApacheCon US 2007: Open Source Community AntipatternsTed Leung
 
OSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler ParcelOSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler ParcelTed Leung
 
PyCon 2005 PyBlosxom
PyCon 2005 PyBlosxomPyCon 2005 PyBlosxom
PyCon 2005 PyBlosxomTed Leung
 
SeaJUG March 2004 - Groovy
SeaJUG March 2004 - GroovySeaJUG March 2004 - Groovy
SeaJUG March 2004 - GroovyTed Leung
 
OSCON 2004: XML and Apache
OSCON 2004: XML and ApacheOSCON 2004: XML and Apache
OSCON 2004: XML and ApacheTed Leung
 
OSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of ChandlerOSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of ChandlerTed Leung
 
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJSeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJTed Leung
 
IQPC Canada XML 2001: How to develop Syntax and XML Schema
IQPC Canada XML 2001: How to develop Syntax and XML SchemaIQPC Canada XML 2001: How to develop Syntax and XML Schema
IQPC Canada XML 2001: How to develop Syntax and XML SchemaTed Leung
 
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationIQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationTed Leung
 

More from Ted Leung (20)

DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 Keynote
 
A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency Constructs
 
Seeding The Cloud
Seeding The CloudSeeding The Cloud
Seeding The Cloud
 
Programming Languages For The Cloud
Programming Languages For The CloudProgramming Languages For The Cloud
Programming Languages For The Cloud
 
MySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQLMySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQL
 
PyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for PythonPyCon US 2009: Challenges and Opportunities for Python
PyCon US 2009: Challenges and Opportunities for Python
 
Northwest Python Day 2009
Northwest Python Day 2009Northwest Python Day 2009
Northwest Python Day 2009
 
PyCon UK 2008: Challenges for Dynamic Languages
PyCon UK 2008: Challenges for Dynamic LanguagesPyCon UK 2008: Challenges for Dynamic Languages
PyCon UK 2008: Challenges for Dynamic Languages
 
OSCON 2008: Open Source Community Antipatterns
OSCON 2008: Open Source Community AntipatternsOSCON 2008: Open Source Community Antipatterns
OSCON 2008: Open Source Community Antipatterns
 
OSCON 2007: Open Design, Not By Committee
OSCON 2007: Open Design, Not By CommitteeOSCON 2007: Open Design, Not By Committee
OSCON 2007: Open Design, Not By Committee
 
Ignite The Web 2007
Ignite The Web 2007Ignite The Web 2007
Ignite The Web 2007
 
ApacheCon US 2007: Open Source Community Antipatterns
ApacheCon US 2007:  Open Source Community AntipatternsApacheCon US 2007:  Open Source Community Antipatterns
ApacheCon US 2007: Open Source Community Antipatterns
 
OSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler ParcelOSCON 2005: Build Your Own Chandler Parcel
OSCON 2005: Build Your Own Chandler Parcel
 
PyCon 2005 PyBlosxom
PyCon 2005 PyBlosxomPyCon 2005 PyBlosxom
PyCon 2005 PyBlosxom
 
SeaJUG March 2004 - Groovy
SeaJUG March 2004 - GroovySeaJUG March 2004 - Groovy
SeaJUG March 2004 - Groovy
 
OSCON 2004: XML and Apache
OSCON 2004: XML and ApacheOSCON 2004: XML and Apache
OSCON 2004: XML and Apache
 
OSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of ChandlerOSCON 2004: A Developer's Tour of Chandler
OSCON 2004: A Developer's Tour of Chandler
 
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJSeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
SeaJUG Dec 2001: Aspect-Oriented Programming with AspectJ
 
IQPC Canada XML 2001: How to develop Syntax and XML Schema
IQPC Canada XML 2001: How to develop Syntax and XML SchemaIQPC Canada XML 2001: How to develop Syntax and XML Schema
IQPC Canada XML 2001: How to develop Syntax and XML Schema
 
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationIQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
 

Recently uploaded

QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Recently uploaded (20)

QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

XML and Java Lessons

  • 1. XML and Java: Lessons Learned in Building Application Ted Leung Technical Lead, XML4J Parser
  • 2. Agenda Technology background XML Java Architectures Guidelines XML Tools Summary
  • 3. Distributed OO Middlewar Java XML Portable Programs Portable Data Open Standards Distributed Object Infrastructure CORBA IP Network Pervasive Networks
  • 4. XML - eXtensible Markup Language XML was derived from SGML 80% of function, 20% of complexity XML is key for e-business standard way to share structured data XML and Java work well together Java = portable code XML = portable data XML says nothing about presentation
  • 5. XML example - Address Book Address Book Markup Language sample <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <!DOCTYPE addressBook SYSTEM quot;abml.dtdquot;> <addressBook> <person salary=quot;26350.00quot; band=quot;Dquot;> <name> <family>Wallace</family> <given>Bob</given> </name> <email>bwallace@megacorp.com</email> </person> </addressBook>
  • 6. Document Type Description DTD Example for Address Book <?xml encoding=quot;UTF-8quot;?> <!ELEMENT addressBook (person)+> <!ELEMENT person (name,email*)> <!ATTLIST person salary CDATA #REQUIRED > <!ATTLIST person band (A|B|C|D|E|F) #REQUIRED > <!ATTLIST person active (true|false) quot;truequot; #IMPLIED > <!ELEMENT name (family, given)> <!ELEMENT family (#PCDATA)> <!ELEMENT given (#PCDATA)> <!ELEMENT email (#PCDATA)>
  • 7. A Sampling of DTDs Open Financial Bean Markup Language Exchange (OFX) (BML) Online Trading Protocol Translation Memory (OTP) eXchange (TMX) Information and Content Mathematical Markup Exchange (ICE) Language (MathML) XML Bookmark Scalable Vector Graphics Exchange Language (SVG) (XBEL) Astronomical Markup Channel Definition Language (AML) Format (CDF) Biopolymer Markup XML Remote Procedure Language (BIOML) Call (XML-RPC) Common Business Library Wireless Markup (CBL) Language (WML) Extensible Logfile Format Resource Description (XLF)
  • 8. XSLT / XSL XSL = eXtesnbile Stylesheet Language XSL is an XML to XML transformation system There are two parts XSLT is the tree transformation part of the language Formatting Objects The transformation is declaratively specified in XML A big use of XSL is to convert XML to HTML Still in working draft stage Being combined with XPointer
  • 9. XSLT Example <?xml version=quot;1.0quot; encoding=quot;US-ASCIIquot;?> <xsl:stylesheet xmlns:xsl=quot;http://www.w3.org/XSL/Transform/1.0quot;> <xsl:template match=quot;personquot;> <html><body> <xsl:apply-templates/> </body></html> </xsl:template> <xsl:template match=quot;namequot;> <!-- reverse given & family name --> <xsl:value-of select='given'/> <xsl:text> </xsl:text> <xsl:value-of select='family'/> </xsl:template> <xsl:template match=quot;emailquot;> <a> <xsl:attribute name=quot;hrefquot;> <!-- add an href attribute --> <xsl:text>mailto:</xsl:text> <xsl:apply-templates/> </xsl:attribute> <xsl:apply-templates/> </a> </xsl:template> </xsl:stylesheet>
  • 10. XSLT Result <html> <body> Bob Wallace <a href=quot;mailto:bwallace@megacorp.comquot;> bwallace@megacorp.com </a> </body> </html>
  • 11. XML Schema A richer language for constraining XML content Syntax is regular XML syntax, not DTD syntax Support for data typing, inheritance, namespaces Still in early Working Draft form
  • 12. XML Schema Example <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <!DOCTYPE schema PUBLIC quot;-//W3C/DTD XML Schema Version 1.0//ENquot; quot;http://www.w3.org/1999/05/06-xmlschema-1/structures.dtdquot;> <schema> <elementType name=quot;addressBookquot;> <elementTypeRef name=quot;personquot; minOccur=quot;1quot;></elementTypeRef></elementType> <elementType name=quot;personquot;> <sequence occurs=quot;1quot;> <elementTypeRef name=quot;namequot; minOccur=quot;1quot; maxOccur=quot;1quot;></elementTypeRef> <elementTypeRef name=quot;emailquot; minOccur=quot;0quot;></elementTypeRef></sequence> <attrDecl name=quot;bandquot; required=quot;truequot;> <datatypeRef name=quot;NMTOKENquot;> <enumeration> <literal>A</literal> <literal>B</literal> <literal>C</literal></enumeration></datatypeRef></attrDecl> <attrDecl name=quot;activequot;> <datatypeRef name=quot;NMTOKENquot;> <enumeration> <literal>true</literal> <literal>false</literal></enumeration> <default>true</default></datatypeRef></attrDecl></elementType> <elementType name=quot;namequot;> <sequence occurs=quot;1quot;> <elementTypeRef name=quot;familyquot; minOccur=quot;1quot; maxOccur=quot;1quot;></elementTypeRef> <elementTypeRef name=quot;givenquot; minOccur=quot;1quot; maxOccur=quot;1quot;></elementTypeRef></sequence></elementType> </elementType></schema>
  • 13. Must I use Java to use XML? NO!!! While many of the best programming tools for XML are currently Java-based, XML is completely language neutral XML is about system-to-system interaction and component-to-component collaboration, regardless of the underlying programming technology
  • 14. Servlets Servlet is a Java class that can be used to dynamically extend your server's function. Servlets, as defined by Sun, are: quot;... objects which conform to a specific interface that can be plugged into a Java-based server. Servlets are similar to applets in that they are object byte codes that can be dynamically loaded off the net.... They serve as platform independent, dynamically loadable, plugable helper byte-code objects on the server side....quot; In short, a servlet is to the server what the applet is to the client browser. Servlets have a standard interface, which is defined in the package javax.servlet.
  • 15. What XML and Java are Not A silver bullet still have to design, code, and test Guaranteed communication agreement between vendors and users is still required Not an Object-Oriented Modeling Language use UML/XMI for that Not middleware used to develop robust middleware A replacement for HTML
  • 16. Java + XML - The Winning Team Application Client Gateway Resource Managers Server DB2 EJBs and stored procs. Servlet Enterprise Applet s msg JavaBeans JavaBeans JavaBeans XML XML & SQL stored data XML msgs XML msgs via IIOP or MQ or IPC via IIOP or via HTTP or XM Lm MQ or IPC IIOP or MQ CICS sg s EJBs and Standard CICS trans. Browser XM XML & VSAM XML Lm stored data Enabled sg Browser s Domino EJBs and Java agents Applications = Programs + Data XML & forms stored data
  • 17. Architectures using Servlets and XML We will discuss some architectures which combine use of servlet and XML. The application server which the servlet interacts with could be an EJB server; a database with or without Java stored procedures; MQSeries; CICS;etc. We will present design considerations based on work we have done with customers when designing servlets and XML. special focus on supporting business objects
  • 18. HTML/XML/DB Architecture HTML -> servlet -> XML -> Query (SQL) -> DB HTML <- XSL <- XML <- JDBC result set <- DB RDB Java Application Server Browser Server WebServer + Servlet Engine Displays initial servlet transform HTML HTML page XML converted into SQL query JDBC is called calls input into XML Servlets using HTML form HTTP action calls a servlet JDBC <FORM METHOD= POST ACTION= quot;/servlet/GetDataServletquot;> XML4J Parser HTML generator HTML page HTML converted into JDBC results showing the results of the using XSL query XML XSL file
  • 19. An Example Application Problem Client Requirements support an applet client for Intranet users support a thin HTML client for Internet users support interfaces to third-party applications Complex business logic business objects to be used on server and in applet Security authentication and single logon SSL encryption Scalability using multiple servers and tiers Server to access data in a relational database Note: other types of backends could be use instead of RDB
  • 20. Applet to Java Server using RMI (no XML) Applet <-> RMI <-> servlet Client Browser Java Application Server RDB Java Applet (no webserver) Server Java Infrastructure to DB - creates Remote RMI skeletons and RMI Method Invocation Business Objects JDBC over Business Objects the busines objects sockets RMI stubs GUI Java Objects serialized objects are sent RMI calls Third-party applications RMI Skeletons and RMI Objects
  • 21. Applet to Servlet Architecture using XML applet <-> bus objects <-> XML <-> servlet <-> bus objects Client Browser Java Application Server RDB Java Applet WebServer + Servlet Engine Server servlet toXML toXML calls Infrastructure to DB - creates using Java GUI (AWT, Swing) HTTP passing Business Objects XML Business Objects JDBC Servlet Callers the busines objects Servlets XML returned Customized Customized XML 4Java XML 4Java Parser using Parser using SAX API SAX API
  • 22. Third-party to Servlet Architecture using XML Third-party application <-> XML <-> servlet <-> bus objects Java Application Server Third-Party RDB WebServer + Servlet Engine Application Server servlet toXML calls Infrastructure to DB - creates Application in using HTTP any language passing XML Business Objects JDBC XML parser to the busines objects Servlets xxx language servlet callers XML or returned into a RDB or Customized XML 4Java transformed to Parser using HTML SAX API
  • 23. Potential Benefits using XML and Servlets Together Leverage webserver technology for provide security single logon servlet security SSL is very simple Highly scaleable using webserver and load balancing technology Integration into a large website is simplified Provide distinct, flexible interface the application servers between application components for 3rd party Support multiple front-ends transform results from XML to HTML using XSL 3rd applications written in any language can call the servlets and receive XML queuing of messages is easily supported XML rendered directly in the browser
  • 24. Design Choices - XML Non-technical considerations cooperation in industry (suppliers, consumers) competitive advantage dominant players may dictate When to use DTD validation better performance without validation turn off when system is closed, turn on for third-party use XML type definition is limited to Strings modeling work is required to map objects or tables Consider XML namespace issues To transform business objects to XML requires custom code Storing XML into a RDB map from flat text structure to relational tables map from business object to relational tables store XML into text extenders more direct support for XML is coming
  • 25. Design Choices - DOM vs SAX wrt XML <-> Busines Objects Both DOM and SAX being widely supported and standardized DOM SAX API oriented mechanism Creates a Document which is triggered by XML Object Model tree. tags DOM tree which must be Calls handler when XML reparsed and converted tag is read into business objects. DOM tree is not really Generates events without used. the DOM tree Need to subclass Code is straightforward business objects from DOM superclass Subclassing DOM parser is more complex code.
  • 26. Design Choices - DTD Specification Designed to support generalization Simple instance data represented as attributes instead of sub-elements performance tradeoff vs richness of information Inheritance XML's flat structure does not provide any inherent support for inheritance superclass attributes included in the DTD for every concrete subclass Relationships represented as generalized 'Association elements' <!ELEMENT Association EMPTY > <!ATTLIST Association name CDATA #REQUIRED multiplicity (1..1|1..n|n..m) #REQUIRED oids CDATA #REQUIRED > No contained objects are defined in the DTD Linked to lazy initialization of relationships
  • 27. Design Choices - Servlets Calls to servlets serve as API calls into the Java Server 'command' and parameters can be included as a parameter of the servlet ex. VehicleServlet?command=retrieve&oid=1234567 basic validation of commands represent the APIs in the XML which is passed to the servlet Servlet design Single command processor servlet Seperate servlet for each set of related commands such as CRUD for a business object Seperate servlet for each command Handle required parameter information versus optional information API should be 'forgiving' i.e. able to handle unexpected information and lack of optional information
  • 28. Guidelines for Development Process Get help/input from business people Model the business objects and DTD separately want your DTD to be application independent DTD should be designed independently of a data or object model but with consideration of the databases and applications to be supported i.e. start from a purist view and compromise map between the business objects, database, and XML as needed Validate DTD with business people and third-parties keep it simple where possible prototype, prototype, prototype measure performance search for existing solutions and tools XML and Java tool space moves quickly
  • 29. XML Architectures (future is coming quickly) XML directly in and out of DB2 HTML -> servlet -> XML -> DB2 DB2 -> XML -> XSL processing servlet -> HTML XML transformed by MQ XML directly rendered in a browser using XSL XML used with MQ Integrator to communicate between business or systems XML with Java Messaging Service (JMS) XML provides configuration information for systems
  • 30. XML Tools Changing drastically / quickly Standards are moving quickly, tools keeping up Java is preferred development language Unicode support Tool Categories XML Parsers Database support Messaging product support XML Editors XSL Processors Java class libraries digital signature visual beans
  • 31. IBM XML Tools Available from Alphaworks (www.alphaworks.ibm.com) XML Parser for Java (XML4J) Lotus XSL XML Productivity Kit for Java XML Security Suite Xeena Bean Markup Language P3P XML Diff and Merge, XML TreeDiff XML Parser for C++ WebSphere MQ Series DB2
  • 32. External IBM XML Website fo in L M fX o ce r ou ts es rb ou Y
  • 33. DEMO
  • 34. Resources Useful Sites www.ibm.com/xml www.ibm.com/java www.alphaworks.ibm.com www.xml.com www.xml.org Contacts xml4j@us.ibm.com