Providing Webbased Access and Integrating with XML - PowerPoint PPT Presentation

About This Presentation
Title:

Providing Webbased Access and Integrating with XML

Description:

Cascading style sheets (CSS) separates content from fromat ... (has APIs for TV, phone, telematics and so on) Also connects to J2EE and Web services. ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 37
Provided by: bina1
Learn more at: https://cse.buffalo.edu
Category:

less

Transcript and Presenter's Notes

Title: Providing Webbased Access and Integrating with XML


1
Providing Web-based Access and Integrating with
XML
  • B. Ramamurthy
  • Chapter 8 and 9

2
Topics for Web access
  • Web access environments (See figure 8.1)
  • Client facilities
  • Web server facilities
  • Session management
  • Specialized client devices

3
Web application configuration
User client
User client
User client
Web server
Database server
Application server
4
Client Facilities
  • Provide adequate interactive performance
  • Ensure integrity of system updates
  • Minimize the risk of exposure of confidential
    data
  • Minimize network activity
  • Enable disconnected user activity

5
Implementing Client Functionality
  • Static pages
  • HTML and variations of it
  • Caching to help performance
  • Cascading style sheets (CSS) separates content
    from fromat
  • HTML pages provide FORMs to accept user input
    that may generate actions.
  • Active contents applets, plug ins, javascripts,
    JSP etc.
  • Stand alone applications, esp. when it is not
    real-time.

6
Web Application Components
HTML Objects
Servlets
JSPs
Database server
Application objects
7
Java Server Pages
  • JSP model is well suited for process XML
    documents
  • Besides the directives, actions, and scripting
    elements, it is possible to access Java Beans and
    support a rich library of tags.
  • Tag libraries provide for sharing of actions
    among multiple JSPs. They provide implicit
    objects for a given environment.
  • JSP to XML and back is convenient feature.

8
Session Management
  • HTP is stateless. To maintain the user state we
    can use
  • URL variables (using session key as a variable,
    insecure)
  • Cookies (a packet of information communicated
    between the client and the server and stored on
    the client side, not secure),
  • Secure Socket Layer (SSL) protocol
  • A session is established, session key is defined
    for encryption and communication for the duration
    of the session.

9
Specialized Client Devices
  • Handheld devices such as cell phones and personal
    digital assistants (PDAs) are becoming popular
    for remote user access to systems.
  • See Suns support for this http//java.sun.com/j2
    me/technologies
  • (has APIs for TV, phone, telematics and so on)
  • Also connects to J2EE and Web services.

10
Integrating with XML (Chapter 9)
  • XML is anew markup language, developed by W3C
    (World Wide Web Consortium), mainly to overcome
    the limitations of HTML.
  • But it took a life of its own and has become a
    very popular part of distributed systems.
  • We will examine its definition, associated
    specifications (DTD, XSLT etc.), Java APIs
    available to process XML, protocols and services
    based on XML, and the role XML plays in
    enterprise integration.

11
First Look at XML
  • It has no predefined tags.
  • Such as in HTML
  • Domains may specify their own set of standard
    tags
  • It is stricter.
  • Most html document have errors and the browser
    have to built to take care of these.
  • On the other hand XML has a strict syntax.
  • There is a notion of validity and
  • A notion of well-formed.

12
XML document Content
  • XML documents are composed of markup and contents
  • Six kinds of markup
  • Element
  • Attributes
  • Entity References
  • Comments
  • Processing instructions
  • CDATA sections

13
Elements
  • Elements are the most common form of markup.
  • Delimited by angle brackets, most elements
    identify the nature of the content they surround.
  • Example ltallengtltquotegtGoodnight,
  • Gracie.lt/quotegtlt/allengt
  • Some elements may be empty, as seen above, in
    which case they have no content. If an element is
    not empty,it begins with a start-tag, ltelementgt,
    and ends with an end-tag, lt/elementgt.
  • Exampleltapplause/gt

14
Attributes
  • Attributes are name-value pairs that occur inside
    start-tags after the element name. For example,
  • ltdiv class"preface"gt
  • is a div element with the attribute class having
    the value preface.
  • In XML, all attribute values must be quoted.

15
Entities
  • In XML, entities are used to represent these
    special characters.
  • Entities are also used to refer to often repeated
    or varying text and to include the content of
    external files.
  • Example amp to represent
  • US to represent United States
  • XML also has a set of predefined entities quot,
    amp

16
Comments
  • Comments begin with lt!-- and end with --gt.
    Comments can contain any data except the literal
    string --. You can place comments between markup
    anywhere in your document.
  • Example
  • lt! loosely inspired by the vcard3.0 --gt

17
Processing Instructions(PI)
  • Processing instructions (PIs) are an escape hatch
    to provide information to an application. Like
    comments, they are not textually part of the XML
    document, but the XML processor is required to
    pass them to an application.
  • Processing instructions have the form lt?name
    pidata?gt
  • Example
  • lt?xml-stylesheet hrefsimple-ie5.xsl
    typetext/xsl?gt

18
CDATA
  • In a document, a CDATA section instructs the
    parser to ignore most markup characters.
  • lt?xml version1.0?gt
  • ltexamplegt
  • ltCDATA
  • lt?xml verion1.0?gt
  • ltentrygt .
  • lt/entrygtgt
  • lt/examplegt

19
Well Formed and Valid
  • A document is well formed if it obeys the syntax
    of XML
  • A well formed document if valid if it contains a
    proper document type declaration and if the
    document obeys the constraints of the
    declaration
  • Element sequence
  • Valid nesting
  • Required attributed provided
  • Attributes values are of correct type

20
Enterprise Application Characteristics
  • Communicate using email, ftp, edi, soap
  • Received messages are published on message queues
    for guaranteed store/forward delivery.
  • Consumers can subscribe to messages of interest.
  • Messages can be transformed using variety of
    schemes XSLT, GUI, user-defined.
  • Internal business processes can be triggered by
    these messages.

21
Role of XML
  • Primary task is movement and interpretation of
    messages.
  • XML offers the following benefits
  • Well-defined grammar for defining message
    structures (DTD)
  • Tools such as parsers, notepad available for
    working with XML documents
  • Tools available for generating and consuming XML
    messages (Ex numerous APIs offered by SUN)

22
XML Processing Models
  • XML Input Processing
  • Business Logic Handling
  • XML Output Processing

WEB
BO
EXTRACT
XML output
XML input
23
Document Data TypeDTD
  • The purpose of a DTD is to define the valid
    building blocks of an XML document. It defines
    the document structure with a list of valid
    elements.
  • It is similar to a type (/class) declaration in
    programming language context.
  • A DTD can be declared inline in your XML
    document, or as an external reference.
  • DTD defines the grammar of an XML document.

24
DOCTYPE
  • If the DTD is internal to an XML file it has to
    be wrapped in a DOCTYPE
  • lt!DOCTYPE root-element element-declarationsgt
  • If the DTD is external to the XML file then, the
    filename has be referenced within the DOCTYPE
    tag
  • lt!DOCTYPE root-element SYSTEM "filename"gt

25
Example Internal DTD
lt?xml version1.0?gt lt!DOCTYPE memo lt!ELEMENT
memo (header,from,to, body,sign)gt lt!ELEMENT
header (PCDATA)gt lt!ELEMENT from
(PCDATA)gt lt!ELEMENT to (PCDATA)gt lt!ELEMENT
body (PCDATA)gt lt!ELEMENT sign (PCDATA)gtgt ltmem
ogt ltheadergt Hello World lt/headergt ltfromgt bina
lt/fromgt lttogt cse586 lt/togt ltbodygt Wake up
everyone lt/bodygt ltsigngt br lt/signgt lt/memogt
26
Example External DTD memo.xml
lt?xml version1.0?gt lt!DOCTYPE memo SYSTEM
memo.dtdgt ltmemogt ltheadergt Hello World
lt/headergt ltfromgt bina lt/fromgt lttogt cse586
lt/togt ltbodygt Wake up everyone lt/bodygt ltsigngt br
lt/signgt lt/memogt
27
memo.dtd
lt!ELEMENT memo (header,from,to,
body,sign)gt lt!ELEMENT header (PCDATA)gt
lt!ELEMENT from (PCDATA)gt lt!ELEMENT to
(PCDATA)gt lt!ELEMENT body (PCDATA)gt lt!ELEMENT
sign (PCDATA)gt
28
DTD Element
  • In a DTD XML elements are declared with an
    ELEMENT tag.
  • You declare an element using these formats
  • lt!ELEMENT element-name element-typegt
  • lt!ELEMENT element-name (element-content)gt

29
Element Declarations
Empty element lt!ELEMENT element-name EMPTYgt DTD
lt!ELEMENT BON EMPTYgt XML ltBON
/gt Elements with one character data lt!ELEMENT
elem-name (PCDATA)gt lt!ELEMENT from
(PCDATA)gt lttogt cse586 lt/togt Elements with
sub-elements lt!ELEMENT elem-name (elem1, elem2,
..)gt lt!ELEMENT memo (header, from, to, body,
sign)gt See memo.xml for example
30
Element Declarations
lt!ELEMENT elem-name (sub-elem)gt one or more
subelements lt!ELEMENT elem-name (sub-elem)gt
zero or more subelements lt!ELEMENT elem-name
(sub-elem?)gt zero or one Declaring mixed
sub-elements lt!ELEMENT memo (header,to,from,para
,PCDATA)gt
31
XSLT
  • XSLT is XML Style Language Transforms
  • XSLT transforms the content of an XML document
    into another form which could possibly be another
    XML document.
  • In an XSLT processor, the information in the XML
    source document will be evaluated, rearranged,
    then reassembled.
  • Most visible outcome is a pretty version of the
    content of the XML document.
  • XSLT more importantly provides flexible source
    information, called Result Tree, that can be
    easily added to, modified, or reordered.

32
Displaying XML
  • XML Document?XSL Trans?HTML Doc ?Web Browser
  • XML Document CSS Style sheet?XML-enabled Web
    Browser
  • XML Document XSL StyleSheet ? XSL Display Engine

33
Style sheet
  • Two details are specified
  • Transformation of input document into another
    form (optional)
  • Description of how to present the transformed
    information

34
Transformation Capabilities
  • Generation of constant text
  • Suppression of content
  • Moving text
  • Duplicating text
  • Sorting
  • Compute new information from given information

35
Formatting capabilities
  • Specification of general layout
  • Assignment of the transformed content into basic
    units (paragraph, lists etc.)
  • Specify formatting properties (margins, alignment
    etc.)

36
Components of XSL
  • XPath XML Path language for referencing parts of
    the XML document
  • XSLT XSL Transformations for transforming one
    form to another
  • XSL Extensible Style Sheet Language For
    formatting objects
Write a Comment
User Comments (0)
About PowerShow.com