Top Banner
IBM India © Copyright IBM Corporation 2005 Oracle XML Publisher Oracle XML Publisher An Overview By Rashmi Kumari
31

XML Publisher PPT

Apr 18, 2015

Download

Documents

Sandy
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: XML Publisher PPT

IBM India

© Copyright IBM Corporation 2005

Oracle XML PublisherOracle XML Publisher

An OverviewBy Rashmi Kumari

Page 2: XML Publisher PPT

| Apr 11, 2023 | 2

IBM India

© Copyright IBM Corporation 2005

To Discuss on

XML Publisher What and Why Requirements Development Approach

- Steps Overview- Develop Report Template – RTF template and Register

- Some Frequently Used Tags - Data Definition Design

- Development Steps using PL/SQL

- Different PL/SQL Approaches

- Development steps using data template

Page 3: XML Publisher PPT

| Apr 11, 2023 | 3

IBM India

© Copyright IBM Corporation 2005

XML Publisher What and Why

Page 4: XML Publisher PPT

| Apr 11, 2023 | 4

IBM India

© Copyright IBM Corporation 2005

Classic Reporting Tool Issue

Page 5: XML Publisher PPT

| Apr 11, 2023 | 5

IBM India

© Copyright IBM Corporation 2005

Classic Reporting Tools Issue

Data logic Layout

TranslationReport file

• Less flexibility

• High Development Cost

• High Customization Cost

• Difficult Upgrade

Page 6: XML Publisher PPT

| Apr 11, 2023 | 6

IBM India

© Copyright IBM Corporation 2005

XML Publisher Concept

Separate data / layout / translation

Reportoutput

More flexibilityReduced maintenance

Data Logic

Layout

TranslationXML Publisher

Page 7: XML Publisher PPT

| Apr 11, 2023 | 7

IBM India

© Copyright IBM Corporation 2005

Extract Once – Publish Multiple Times

Page 8: XML Publisher PPT

| Apr 11, 2023 | 8

IBM India

© Copyright IBM Corporation 2005

Requirements..

Creating reports using XML Publisher can be divided into two components: Report Query (XML) and Template (Layout).

XML Publisher Administrator Responsibility Report Query can be developed using:

- Reporting tool like Oracle Reports6i- PLSQL program (Packaged procedure)- Data Template (Also Known as XDO Reporting)

Template (RTF) can be developed using:- Template Builder provided by Oracle

(The tool needs to be installed on your desktop, which provides add-on toolbar in MSWord.)

Page 9: XML Publisher PPT

| Apr 11, 2023 | 9

IBM India

© Copyright IBM Corporation 2005

Development Approach

Page 10: XML Publisher PPT

| Apr 11, 2023 | 10

IBM India

© Copyright IBM Corporation 2005

Development Steps

1. Create and register report as concurrent program2. Generate the XML file and download it in development work space3. Design the template4. Map the template with XML file tag5. Register the data definition and template

Here it is assumed that report query will be developed using Oracle reporting tool and layout is RTF template

Page 11: XML Publisher PPT

| Apr 11, 2023 | 11

IBM India

© Copyright IBM Corporation 2005

Create Concurrent Program – Prepare Data in XML

Copy To…

IMPORTANTThe Concurrent Program “Short Name” must match the “Source Code” of the Data Definition

Copy any existing report or create a new one with output type XML

Page 12: XML Publisher PPT

| Apr 11, 2023 | 12

IBM India

© Copyright IBM Corporation 2005

Generate XML Output

Page 13: XML Publisher PPT

| Apr 11, 2023 | 13

IBM India

© Copyright IBM Corporation 2005

The XML Output

Page 14: XML Publisher PPT

| Apr 11, 2023 | 14

IBM India

© Copyright IBM Corporation 2005

Design Template

Page 15: XML Publisher PPT

| Apr 11, 2023 | 15

IBM India

© Copyright IBM Corporation 2005

Identify Placeholders & Groups

PlaceholdersIndividual Fields, e.g.

- PO Number- Vendor Name- Product Description

GroupsRepeating Elements, e.g.

- PO Lines- Purchase Orders

Page 16: XML Publisher PPT

| Apr 11, 2023 | 16

IBM India

© Copyright IBM Corporation 2005

Map Template

Page 17: XML Publisher PPT

| Apr 11, 2023 | 17

IBM India

© Copyright IBM Corporation 2005

Basic RTF

Page 18: XML Publisher PPT

| Apr 11, 2023 | 18

IBM India

© Copyright IBM Corporation 2005

Form Field Method

Page 19: XML Publisher PPT

| Apr 11, 2023 | 19

IBM India

© Copyright IBM Corporation 2005

Register Data Definition

1. The Application mustmatch that of thereport

2. The “Code”must match the“Short Name” of thereport

3. Attach a sample ofyour XML output topreview and test yourtemplate

Page 20: XML Publisher PPT

| Apr 11, 2023 | 20

IBM India

© Copyright IBM Corporation 2005

Register Template

1. The Application mustmatch that of thereport

2. The Type must matchthe file type of yourdesign

3. A Data Definition is“Required”, but it maysimply be a place-holder

4. However, by loadingsample XML, you canpreview the template

5. You can add differenttemplates for eachlanguage and region

Page 21: XML Publisher PPT

| Apr 11, 2023 | 21

IBM India

© Copyright IBM Corporation 2005

Print Report

Page 22: XML Publisher PPT

| Apr 11, 2023 | 22

IBM India

© Copyright IBM Corporation 2005

Finished Result

Page 23: XML Publisher PPT

| Apr 11, 2023 | 23

IBM India

© Copyright IBM Corporation 2005

Some Frequently Used Tags

For defining Elements

<?XML element tag name?> e.g. <?FIRST_NAME?>

For defining Groups

<?for-each:XML group element tag name?> <?end for-each?> e.g. <?for-each:G_DEPT?> <?end for-each?>

For Header and Footer<?start:body?> and <?end body?>For Conditional Formatting<?if:condition?> <?end if?> e.g. <?if:cs_no_data_found=1?>*** NO DATA*** <?end if?><?xdofx:if element_condition then result1 else result2 end if?> e.g. <?xdofx:if AMOUNT > 1000 then ’High’ else if AMOUNT < 1000 then ’Low’ else ’Equal’ end if?>For Page Totals<?add-page-total:TotalFieldName;’element’?><?show-page-total:TotalFieldName;’number-format’?>For Defining Variable<?xdoxslt:set_variable($_XDOCTX, ’RTotalVar’, 0)?> <?xdoxslt:get_variable($_XDOCTX, ’RTotalVar’)?>

Page 24: XML Publisher PPT

| Apr 11, 2023 | 24

IBM India

© Copyright IBM Corporation 2005

Some Frequently Used Tags Contd….

For Sorting

<?sort:element name?> e.g. <?sort:FIRST_NAME?>

For Checking Nulls

<?if:element_name!=?> <?end if?>

<?if:element_name and element_name="?>

<?if:not(element_name)?>

For arithmetic and string operations

<?xdofx:2+3?>, <?xdofx:2-3?>, <?xdofx:2*3?>, <?xdofx:2/3?>, <?xdofx:2**3?>, <?xdofx:3||2?><?xdofx:lpad(’aaa’,10,’.’)?>, <?xdofx:rpad(’aaa’,10,’.’)?>, <?xdofx:decode(’xxx’,’bbb’,’ccc’,’xxx’,’ddd’)?>, <?xdofx:Instr(’abcabcabc’,’a’,2)?>, <?xdofx:substr(’abcdefg’,2,3)?>, <?xdofx:sysdate()?>, <?xdofx:to_number(’12345’)?>, <?xdofx:replace(name,’John’,’Jon’)?>, <?xdoxslt:minimum(ELEMENT_NAME)?>, <?xdoxslt:maximum(ELEMENT_NAME)?>

Page 25: XML Publisher PPT

| Apr 11, 2023 | 25

IBM India

© Copyright IBM Corporation 2005

Data Definition Design

Page 26: XML Publisher PPT

| Apr 11, 2023 | 26

IBM India

© Copyright IBM Corporation 2005

Development Steps using PL/SQL

Create a Packaged Procedure which will generate output in XML Format Register the executable as PL SQL Stored procedure Register the Concurrent Program Set the Output as XML Create the template Defining the Data definition and Template registration is same as Oracle

Reports steps mentioned in the earlier slides

Page 27: XML Publisher PPT

| Apr 11, 2023 | 27

IBM India

© Copyright IBM Corporation 2005

Ways to Generate XML From PL/SQL

DBMS_XMLGEN it has a number of function to support xml development.

Some Important Functions

newContext(queryString IN VARCHAR2)

setRowTag(ctx IN ctxHandle,rowTag IN VARCHAR2)

setRowSetTag(ctx IN ctxHandle, rowSetTag IN VARCHAR2)

getXML(ctx IN ctxHandle, dtdOrSchema IN number:= NONE) RETURN clob

getXML(sqlQuery IN VARCHAR2, dtdOrSchema IN NUMBER := NONE) RETURN CLOB;

closeContext(ctx IN ctxHandle);

getNumRowsProcessed(ctx IN ctxHandle) RETURN number;

setNullHandling(ctx IN ctxHandle, flag IN NUMBER) where flag values can be

DROP_NULLS CONSTANT NUMBER := 0 ; NULL_ATTR CONSTANT NUMBER := 1 and

EMPTY_TAG CONSTANT NUMBER := 2; This sets, for example, <foo/>.

Example 1 Output of Example1 null_handling_xample

null_hand_output

Page 28: XML Publisher PPT

| Apr 11, 2023 | 28

IBM India

© Copyright IBM Corporation 2005

Ways to Generate XML From PL/SQL Contd…

DBMS_XMLGEN Contd….

can be used in sql querry directly to generate the xml. e.g. SELECT DBMS_XMLGEN.getxml ('select empno, ename, job from emp where rownum < 6' ) xml FROM DUAL;

For nesting of tags there is a cursor function available e.g. SELECT DBMS_XMLGEN.getxml ('select deptno, dname, cursor(select ename, job from emp e where e.deptno = d.deptno) emp_row from dept d where rownum < 4' ) xml FROM DUAL ;

Text Document

Text Document

Page 29: XML Publisher PPT

| Apr 11, 2023 | 29

IBM India

© Copyright IBM Corporation 2005

Ways to Generate XML From PL/SQL Contd…

XMLDOM Package.

Some Important Functions

xmldom.newDOMDocument - used to create a new document handle xmldom.makeNode – Makes a Node. xmldom.createElement – Creates an Element xmldom.appendChild – Appends a Child to a parent node. xmldom.setAttribute- Sets the attribute of an element node. Xmldom.createTextNode- Creates the Text Node. xmldom.writeToFile – Writes the xml tags to a file. xmldom.writeToClob - Writes the xml tags to a CLOB Object.

XMLDOM single Query

single_query_output

multiple querry multiple query output

Page 30: XML Publisher PPT

| Apr 11, 2023 | 30

IBM India

© Copyright IBM Corporation 2005

Development Steps using Data Template

Here we can define the Query in XML format using any text editor, sample Data Template is attached below

After Defining the query, define a concurrent program. We need to use the executable ‘XML Publisher Data Template Executable’ (short name XDODTEXE) for this concurrent program

Data definition short name must be same as concurrent program short name After creation of the Data definition, add the Data Template xml file using Data

Template - ‘Add File’ Button. The RTF template creation and registration is same as other two methods

described earlier

Sample Data Template

Page 31: XML Publisher PPT

| Apr 11, 2023 | 31

IBM India

© Copyright IBM Corporation 2005

Thank You