XML for Java Developers G22.3033-002 Session 4 - Main Theme XML Information Modeling (Part II) Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences 1 Agenda Summary of Previous Session Advanced Logical Structuring and XML Schemas XML-Based Software Development Business Engineering Methodology XML Metadata Management XML Linking/Pointer Language, XML Base, XML Inclusions XML Data Binding Industry Specific Markup Languages Parsing / Generating / Serializing XML Documents XML Metadata Management Tools Assignment 2b (due next week) 2 1 Summary of Previous Session XML Physical Entities Logical Structure of XML Documents XML Document Navigation Java APIs Custom Markup Languages Readings Assignment #2a 3 Advanced Logical Structuring and XML Schemas See http://xml.coverpages.org/schemas.html XML Schema/Validation Proposals XML-Data (XDR) Document Content Description (DCD) Schema for Object-oriented XML (SOX) Document Definition Markup Language (DDML) Schematron Datatypes for DTDs (DT4DTD) Document Structure Description (DSD) Regular Language Description for XML (RELAX) TREX (Tree Regular Expressions for XML) RELAX NG Examplotron Hook Document Schema Definition Language (DSDL) STEP/EXPRESS and XML 4 2 XML-Based Software Development Business Engineering Methodology Language + Process + Tools e.g., Rational Unified Process (RUP) XML Application Development Infrastructure Metadata Management (e.g., XMI) XML APIs (e.g., JAXP, JAXB) XML Tools (e.g., XML Editors, XML Parsers) XML Applications: Application(s) of XML XML-based applications/services MOM & POP Other Services Application Infrastructure Frameworks 5 Business Engineering Methodology Business Model/Architecture Use Case View/Model Application Model/Architecture Logical and Process View/Models Content, Data, and Process Model (e.g., OIM’s knowledge management, and database/datawarehousing models) Application Infrastructure Model/Architecture Implementation View Component Model (e.g., OIM’s component and object model) Technology Model/Architecture Deployment View/Model See Session 4 Sub-Topic 1, and Sub-Topic 2 presentations See Session 4 Handout on “Business and Application Architecture Engineering” 6 3 XML Metadata Management Issue: UML may not provides enough modeling views and enough expressive power in each view to represent a complete application Possible Solutions: Extend UML: See OIM’s Analysis and Design Model Use Different Modeling Languages: See Session 3 handout on “XML Information Modeling” (uses different models such as UML, XML, and ORM) Use a Meta-Model: MOF and XMI See Session 3 handouts on “UML, MOF, and XMI” and “OMG’s XML Metadata Interchange Format (XMI)” Design XML Schemas using UML: 7 http://www-106.ibm.com/developerworks/library/x-umlschem/ XML Linking/Pointer Language XLink Allows elements to be inserted into XML documents in order to create and describe links between resources See Article at http://www.simonstl.com/articles/xlink/ XML Base Equivalent of HTML BASE functionality generically in XML documents by defining an XML attribute named xml:base XPointer http://www.w3.org/TR/xptr-element/, http://www.w3.org/TR/xptrframework/, http://www.w3.org/TR/xptr-xmlns/ Language used as a fragment identifier for URI-references that locates a resource of Internet media type text/xml or application/xml Based on XPath See Tools at http://www.xmlsoftware.com/xlink.html 8 4 XLink Example <my:crossReference xmlns:my="http://example.com/" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="students.xml" xlink:role="studentlist" xlink:title="Student List" xlink:show="new" xlink:actuate="onRequest"> Current List of Students </my:crossReference> 9 XPointer Example <!DOCTYPE SPEECH [ <!ELEMENT SPEECH (#PCDATA|SPEAKER|DIRECTION)*> <!ATTLIST SPEECH ID ID #IMPLIED> <!ELEMENT SPEAKER (#PCDATA)> <!ELEMENT DIRECTION (#PCDATA)>]> <SPEECH ID="a27"><SPEAKER>Polonius</SPEAKER> <DIRECTION>crossing downstage</DIRECTION>Fare you well, my lord. <DIRECTION>To Ros.</DIRECTION> You go to seek Lord Hamlet? There he is.</SPEECH> id(a27).child(2,DIRECTION) Selects the second "DIRECTION" element (whose content is " To Ros.") id(a27).child(2,#text) Selects the second text region , "Fare you well, my lord." (The line break between the SPEAKER and DIRECTION 10 elements is the first text region.) 5 XML Base Example <?xml version="1.0"?> <html xmlns="http://www.w3.org/TR/xhtml1/strict" xml:base="http://somewhere.org"> <head> <title>Virtual Library</title> </head> <body> <p>See <a href="new.xml">what's new</a>!</p> <p>Check out the hot picks of the day!</p> <ol xml:base="/hotpicks"> <li><a href="pick1.xml">Hot Pick #1</a></li> <li><a href="pick2.xml">Hot Pick #2</a></li> <li><a href="pick3.xml">Hot Pick #3</a></li> </ol> </body> </html> "what's new" resolves to the URI "http://somewhere.org/new.xml" \ "Hot Pick #1" resolves to the URI "http://somewhere.org/hotpicks/pick1.xml" "Hot Pick #2" resolves to the URI "http://somewhere.org/hotpicks/pick2.xml" "Hot Pick #3" resolves to the URI "http://somewhere.org/hotpicks/pick3.xml" 11 XML Data Binding Aims to automatically generate substantial portions of the Java platform code that processes XML data A Sun project, codenamed “Adelard” See JSR-31 XML Data Binding Specification, final release 3/4/03 JAXB architecture: http://java.sun.com/xml/downloads/jaxb.html See: http://java.sun.com/xml/jaxp-1.0.1/docs/binding/DataBinding.html 12 6 Industry Specific Markup Languages (see http://www.oasis-open.org/cover/xml.html#contentsApps) Ontology Interchange Language (OIL) OMG Common Warehouse MetaData Interchange (CWMI) OMG Model Driven Architecture (MDA) Open Financial Exchange (OFX) Straight Through Processing Markup Language (STPML) Electronic Commerce Modeling Language (ECML) OASIS Business Transactions Technical Committee (OASISBT) BizTalk Framework (BizTalk) Commerce XML (cXML) RosettaNet (RosettaNet) Business Process Modeling Language (BPML) 13 Readings Readings XML and Java: Chapters 2-3, 8, 15, App. A-C Processing XML with Java: Chapters 3-4, Appendix C Developing Java Web Services: Chapters 7, 8 Handouts posted on the course web site Review XPath 1.0, XLink, XPointer, XML Base, XML Infoset, XML Inclusion W3C Recs Project Frameworks Setup (ongoing) Apache’s Web Server, TomCat/JRun, and Cocoon Apache’s Xerces, Xalan, Saxon Antenna House XML Formatter, Apache’s FOP, X-smiles Visibroker 4.5 (or BES 5.2), WebLogic 6.1-8.1, WAS 5.0 POSE & KVM (See Session 3 handout) 14 7 Assignment Assignment #2a: This part of the project focuses on the application business model discovery using XML information modeling technology. The discovery process should adhere to the following steps: (a) Documenting the information structure, (b) Representing the information structure in XML form, (c) Defining XML DTDs and/or Schemas More specific project related information, and extra credit assignments will be provided during the session 15 Assignment (continued) Assignment #2b: This part of the project relies on the business model discovery process suggested in assignment #2a, and should demonstrate the use of UML use cases to support the development of XML DTDs and/or Schemas Deliverables: XML DTDs and/or Schemas (partial) XMI Model (partial) Use Objects by Design xmi-to-html.xsl style sheet and Cocoon framework to present the resulting model Develop the model using Rational Rose (alternatives are ArgoUML, Poseidon, Together/J, etc.), Java, and the XMI toolkit (see IBM’s EMF, or other tools) 16 8 Next Session: XML Information Processing (Part I) Simple API for XML (SAX) XML Parsers JAXP APIs XML Parsers and Coding Assist Tools 17 9