slide1
Download
Skip this Video
Download Presentation
Making XML Technology Easier to Use

Loading in 2 Seconds...

play fullscreen
1 / 46

Making XML Technology Easier to Use - PowerPoint PPT Presentation


  • 127 Views
  • Uploaded on

Session id: 40108. Making XML Technology Easier to Use. X M L T O T H E P O W E R O F S Q L. Jinyu Wang Senior Product Manager Oracle Corporation. Scott Brewton Principal Instructor Oracle Corporation. XML Widely Accepted. Expanding the business

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Making XML Technology Easier to Use' - verena


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
making xml technology easier to use

Session id: 40108

Making XML Technology Easier to Use

X M L T O T H E P O W E R O F S Q L

Jinyu WangSenior Product Manager Oracle Corporation

Scott BrewtonPrincipal InstructorOracle Corporation

xml widely accepted
XML Widely Accepted
  • Expanding the business
    • XML is widely accepted as the standard data exchange format for B2B, B2C and EAI applications
  • Making use of the legacy applications
    • XML incorporates metadata with data facilitating cross platform data exchange
  • Building e-business applications over the Internet
    • XML provides powerful data abstraction for transaction data management and exchange
  • Publishing content across media and device types
    • XML provides flexible content representations and easy transformations
why simplify the use of xml
Why Simplify the Use of XML
  • XML is not easy to pick up
    • Complex XML syntax
    • Bewildering array of new specs and APIs
  • XML is not straightforward to process
    • Lack of business logic in the document-centric APIs
    • Difficult to connect XML resources
  • XML is overly extensible
    • Many different ways to extend
    • Lack of design guidance
    • XML metadata processing inefficient
xdk simplify the xml development
XDK Simplify the XML Development
  • Simplifies XML parsing
    • New DOM 3.0 support
    • New Built-in SAX output interface
  • Provides simple and powerful XSL transformations
    • New XSLT 2.0 and XPath 2.0 support
  • Easily uses Java with XML binding to Java Objects
    • New JAXB Class Generator
  • Uses the stream-based XML metadata processing
    • New XML Schema validation interfaces
  • Declaratively connects XML processing resources
    • New XML Pipeline Processor
dom xml parsing

Document

Entity Ref

Element

Element

Element

CDATA

Text

Attr

XML

DOM

Parser

DOM XML Parsing
  • A set of object-based APIs that loads an XML document into the memory and represents it as a DOM tree

DOM Tree

dom 3 0 load and save
DOM 3.0: Load and Save
  • Standardizes the XML parsing process
    • DOMInputStream, DOMReader
  • Standardizes the DOM serialization process
    • DOMOutputStream, DOMWriter
  • Allows filtering XML Content during DOM construction
    • DOMParserFilter
  • Provides asynchronous XML DOM parsing
    • DOMImplementationLS.MODE_ASYNCHRONOUS
dom ls standard and flexible dom parsing

XML

XML*

DOM

Parser

DOM LS: Standard and Flexible DOM Parsing
  • Standard Input/output facilitates portable implementation
  • Content Filtering reduces the DOM object footprint
  • Async data access enables efficient XML application

Application

EventListner

Register

Notify

Filter

Input

Output

* Will be in different formats

slide9

D E M O N S T R A T I O N

DOM 3.0 Load and Save

dom 3 0 validation
DOM 3.0: Validation
  • Retrieves Metadata Definitions in XML Schema
    • getDefinedElements
    • getDefaultValue
    • getAllowedParents, getAllowedChildren etc.
    • getContentType
  • Responds to queries for DOM update operations
    • canAppendChild, canReplaceChild, canRemoveChild, canInsertBefore()
  • Validates the DOM document and DOM fragments
    • validateDocument, nodeValidity
dom validation simplify xml editing

Document

Entity Ref

Element

Element

Element

CDATA

Text

Attr

XSD

XSD

DOM

Parser

DOM Validation: Simplify XML Editing
  • XML Schema provides guidance when updating XML
  • Validation ensures valid structure of XML documents

User

DOM Tree

slide12

D E M O N S T R A T I O N

DOM 3.0 Validation

sax xml parsing

StartDocument

EndDocument

StartElement

EndElement

XML

SAX

Parser

SAX XML Parsing
  • A set of event-based APIs that report XML parsing events through callback functions.

Streaming

Streaming

……

SAX Events

sax output serialization
SAX Output Serialization
  • Build-in Java class handles the SAX output serialization
    • oracle.xml.parser.v2.SAXPrintDriver
  • Flexible output options for the SAX output
    • Pretty printing or indenting
    • XML Encoding
    • XML declaration
    • CDATA elements
    • DTD system-id and public-id
  • Simple interface as a SAX Content Handler
    • OracleXMLQuery.getXMLSAX(sample);
simplify the output of sax steaming

StartDocument

EndDocument

StartElement

EndElement

XML

XSU

Simplify the Output of SAX Steaming
  • Streaming without complicated callback functions
  • Flexible build-in output options simplifies content delivery

SQL Query

Streaming

……

JDBC

10g

example for new sax output
Example for New SAX Output

import oracle.xml.parser.v2.XMLSAXPrintDriver;

//Open a File

OutputStream out=new FileOutputStream("out.xml");

DriverManager.registerDriver( new oracle.jdbc.driver.OracleDriver());

conn= DriverManager.getConnection(thinConn, “SH”, “SH”);

XMLSAXPrintDriver sample=new XMLSAXPrintDriver(out);

// Initialized the OracleXMLQuery

OracleXMLQuery qry=new OracleXMLQuery(conn, "select * from sales");

qry.getXMLSAX(sample);

sample.flush();

  • Hands-on Lab: Build Database Applications Lesson 9
xslt transformation

JSP, SQL…

HTML

SVG

PDF

XML

XSL

XML

XSL

XSLT Transformation
  • Transforms and formats one or more XML documents to text-based outputs through XSLT Stylesheets

……

XSLT

Processor

Text Outputs

simplify xslt with xslt 2 0
Simplify XSLT with XSLT 2.0
  • Enables efficient content grouping with simple syntax
    • New built-in grouping support
  • Eliminates node-set conversion
    • New temporary tree support
  • Permits flexible content delivery
    • New multiple output serialization
  • Avoids error-prone character escaping
    • New character mapping support
grouping
Grouping
  • What is Grouping
    • Uses <xsl:for-each-group> to select items
    • Uses options to specify how items are grouped :
      • group-by
      • group-adjacent
      • group-starting-with
      • group-ending-with
    • Refers to current group members with current-group()
  • Value of This Feature
    • Greatly simplifies the grouping operations
    • Allows efficient content processing
example for grouping
Example for Grouping

<xsl:for-each-groupselect=“CATALOG//CD“group-by="COUNTRY">

<xsl:sortselect="COUNTRY"/>

<COUNTRY name="{COUNTRY}">

<xsl:for-each-groupselect="current-group()" group-by="YEAR">

<YEAR year="{YEAR}">

<xsl:for-each select="current-group()">

<xsl:copy-of select="current-group()/TITLE" />

</xsl:for-each>

</YEAR>

</xsl:for-each-group>

</COUNTRY>

</xsl:for-each-group>

slide21

D E M O N S T R A T I O N

XSLT 2.0: Grouping

temporary tree
Temporary Tree
  • What is Temporary Tree
    • Constructed by evaluating an <xsl:variable>, <xsl:param> or <xsl:with-param>
    • Accessible using XPath expressions
    • Processed by the <xsl:apply-templates>, <xsl:for-each> instructions
    • Processed by Key() and id()XPath functions
  • Value of this Feature
    • Eliminates node set conversions
    • Breaks up complex transformation into several steps
    • Allows iterative processing on XML documents
example for temporary tree
Example for Temporary Tree

<xsl:variable name="catalog">

<CATALOG>

<CD>

<TITLE>Empire</TITLE>…

<YEAR>1985</YEAR>

</CD>

<CD>

<TITLE>Still got the blues</TITLE>…

<YEAR>1990</YEAR>

</CD>

</CATALOG>

</xsl:variable>

<xsl:apply-templatesselect="$catalog//CD[number(YEAR)>=1988]/TITLE"/>

slide24

D E M O N S T R A T I O N

XSLT 2.0: Temporary Tree

multiple output serialization
Multiple Output Serialization
  • What is Multiple Output Serialization
    • Creating multiple results from one XSLT Stylesheet
    • Using <xsl:result-document>
  • Value of this Feature
    • Paginates output
    • Generates pages using HTML Frames
    • Creates HTML, SVG and CSS document at one step
example for multiple result documents
Example for Multiple Result Documents

<xsl:output method="xml" indent="yes" name="cd-format"/>

<xsl:template match="/">

<xsl:for-each-groupselect="/CATALOG//CD" group-by="COUNTRY">

<xsl:result-document

href="../output/CD_{current-group()/COUNTRY}.xml"

format="cd-format">

<CD_LIST country="{current-group()/COUNTRY}">

<xsl:copy-of select="current-group()"/>

</CD_LIST>

</xsl:result-document>

</xsl:for-each-group>

</xsl:template>

slide27

D E M O N S T R A T I O N

XSLT 2.0: Multiple Outputs

flexible character mapping
Flexible Character Mapping
  • What is Character Mapping
    • Specifies characters to stand for escaped string
    • Uses <xsl:character-map> and <xsl:output-character>
    • Specifies character to string mapping using Unicode Private Use Area (between #xE000 and #xF8FF)
  • Value of This Feature:
    • Robustly controls the character escaping
    • Provides consistent transformed results
    • Simplifies code generation using XSLT
example for character mapping
Example for Character Mapping

<xsl:outputuse-character-maps="jsp"/>

<xsl:character-mapname="jsp">

<xsl:output-charactercharacter="&#xE001;" string="&lt;%"/>

<xsl:output-charactercharacter="&#xE002;" string="%&gt;"/>

</xsl:character-map>

<xsl:template match="/">&#xE001;@ page language="java" &#xE002;

<HTML>

<BODY>&#xE001; myvariable String; &#xE002;</BODY>

</HTML>

</xsl:template>

slide30

D E M O N S T R A T I O N

XSLT 2.0: Character Mapping

xml schema processor
XML Schema Processor
  • Validates the XML documents against XML schemas
  • Supports LAX and STRICT validation modes
    • XMLParser.SCHEMA_LAX_VALIDATION
    • XMLParser.SCHEMA_STRICT_VALIDATION
  • Supports simple datatypes and complex structures within XML documents
new xml schema validation apis
New XML Schema Validation APIs
  • Retrieving XML Schema validation mode
    • getCurrentMode()
  • Looking up XML elements and attribute content types
    • getElementDeclaration()
    • getAttributeDeclarations()
  • Obtaining associated XML Schema annotations
    • getAnnotation()
streaming xml schema processing

XML

XML

XSD

XML Schema Processor

User

Applications

Streaming XML Schema Processing
  • New APIs allow synchronized metadata retrieval during SAX Streaming

SAX

SAX

Query

example for xml schema validation apis
Example for XML Schema Validation APIs
  • Oracle Database Demo Booth #GG
java architecture for xml binding
Java Architecture for XML Binding
  • Binding Language
    • Describes the binding of source schema to a set of derived packages and classes
  • Schema Compiler
    • Generates Java classes from XML schemas
  • Binding Runtime Framework
    • Unmarshalling: reads XML and construct Java objects tree
    • Marshalling: traverses Java object tree and generate XML
    • Validation: verifies XML Schema constraints on Java objects
jaxb easy to manipulate xml content

ARTIST

PRICE

TITLE

YEAR

CD

JAXB: Easy to Manipulate XML Content

Create XML using DOM :

Element Title, cd;

Text txt;

Title = CreateElement(“Title”);

cd.appendChild(title);

txt=CreateTextElement(“…”);

Title.appendChild(txt);

Unmarshalling XML using JAXB:

CDRecord.setTitle(…)

slide37

D E M O N S T R A T I O N

JAXB Class Binding

xml pipeline processing
XML Pipeline Processing
  • Pipeline Document in XML Vocabulary
    • Specifies the inputs and outputs for XML processes
    • Describes the processing relationships
    • Supports XML Parsing, XSD Validation, XSL Transformation and XML compression
  • Pipeline Controller
    • Establishes a reusable component framework
    • Executes the chains of XML processing
    • Returns the a particular results
    • Optimizes the XML processing
xml pipeline declarative programming
XML Pipeline: Declarative programming

Declaration

1

<pipelinexmlns="http://www.w3.org/2002/02/xml-pipeline“>

<paramname="target" select="myresult.html"/>

<processdef name="domparser.p“ definition="oracle.xml.pipeline.processes.DOMParserProcess"/>

<processdef name="xslstylesheet.p“

definition="oracle.xml.pipeline.processes.XSLStylesheetProcess"/>

<processdef name="xslprocess.p“

definition="oracle.xml.pipeline.processes.XSLProcess"/>

<process id="p2" type="xslstylesheet.p" ignore-errors="false">

<input name="xsl" label="book.xsl"/>

<outparam name="stylesheet" label="xslstyle"/>

</process>…

</pipeline>

Processing Definitions

2

3

Processing Flow

xml pipeline simplify xml processing

XSL

XML

XSD

Out

XML Pipeline: Simplify XML Processing
  • Establishes reusable XML Processing Framework
  • Declarative connection of XML resources

XML

Parser

XSD

Processor

XSL

Processor

XML

Compressor

slide41

D E M O N S T R A T I O N

XML Pipeline Processing

next steps
Next Steps….
  • Recommended sessions
    • 40020: Building High-Performance Enterprise XML Applications with Oracle Database 10g
    • 40255: Manipulating XML with Oracle JDeveloper
  • Recommended demos and/or hands-on labs
    • DB: Application Development: XML to the Power of SQL
    • AS: XML Technologies: Simplify Information Integration
  • See Your Business in Our Software
    • Visit the DEMOgrounds for a customized architectural review, see a customized demo with Solutions Factory, or receive a personalized proposal. Visit the DEMOgrounds for more information.
  • Relevant web sites to visit for more information
    • XML Technology Center – otn.oracle.com/tech/xml
slide43

Q

&

Q U E S T I O N S

A N S W E R S

A

slide45

XML Developer’s Kit

XML TO THE POWER OF SQL

ad