E174
This presentation is the property of its rightful owner.
Sponsored Links
1 / 35

E174 DataWindows, XML & XSL-FO in PowerBuilder 9.0 PowerPoint PPT Presentation


  • 174 Views
  • Uploaded on
  • Presentation posted in: General

E174 DataWindows, XML & XSL-FO in PowerBuilder 9.0. Angelo Scipione Staff S/W Engineer Sybase, Enterprise Solutions Div. [email protected] Agenda. Review the basic concepts of XML Defining XML Templates in the DataWindow Painter

Download Presentation

E174 DataWindows, XML & XSL-FO in PowerBuilder 9.0

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


E174 datawindows xml xsl fo in powerbuilder 9 0

E174 DataWindows, XML & XSL-FOin PowerBuilder 9.0

  • Angelo Scipione

    • Staff S/W Engineer

    • Sybase, Enterprise Solutions Div.

    • [email protected]


Agenda

Agenda

  • Review the basic concepts of XML

  • Defining XML Templates in the DataWindow Painter

  • New DataWindow Properties to control exporting & importing XML

  • Enhanced methods for exporting & importing XML

  • Generating XSL-FO


Review of xml

Review of XML

Extensible Markup Language

  • Extends the ability to represent data

  • Metadata language=tags & layout can be customized

  • Data can be hierarchically structured with nesting

  • Easily parsed across applications, platforms, enterprises, and Web for data interchange

  • Spec at http://www.w3.org/TR/REC-xml


Xml document

XML Document

  • Well-Formed if structure follows XML syntax rules

    • Contains one or more elements

      • Element is a tree containing start-tag, content, end-tag

        • Start-tag is a name, enclosed by angle brackets, with optional attributes

    • One root; all element tags properly nested

  • Valid if structure conforms to a DTD or Schema

    • DTD defines grammar for XML document

      • Subset can be internal or external


Xml parsing

XML Parsing

DOM Parser

  • DOM provides API access to XML tree model

  • Useful if manipulating or re-traversing the document

    SAX Parser

  • Event-driven

  • Useful if extracting data once in single traversal

    Apache Xerces-C++ integrated in PowerBuilder 9.0

  • More on this (PBDOM) presented in E 171


Xml modeled by dom tree

XML Modeled by DOM Tree

<?xml version=“1.0” encoding=“UTF-8”?>

<!DOCTYPE menu SYSTEM menu.dtd>

<menu>

<meal name=“breakfast”>

<food>

Scrambled Eggs

</food>

<food>

Hash Browns

</food>

<drink>

Orange Juice

</drink>

</meal>

<meal name=“snack”>

<food>

Chips

</food>

</meal>

</menu>

menu

meal

meal

name

food

food

drink

“breakfast”

“Scrambled

Eggs”

“Hash

Browns”

“Orange

Juice”


Mapping datawindow to dom tree

Mapping DataWindow to DOM Tree


Datawindow data templates

DataWindow Data Templates

  • Defines the mapping between values from a DataWindow and locations in an external document format, like XML

  • References can be:

    • DataWindow control values (text)

      • Columns

      • Computed Fields

      • Texts

    • DataWindow Expressions (evaluated at runtime)

      • Columns


Datawindow data templates1

DataWindow Data Templates

  • References are specific to a DataWindow’s namespace

  • Persists as its child object in PBL, SRD

  • Can save more than one for a DataWindow

  • Must be uniquely named

  • Template employed at runtime by name with the new UseTemplate DataWindow Property

  • Used for data export and/or import


Export template xml view dw painter

Export Template - XML View (DW Painter)


Other items in an export xml template

Other Items in an Export XML Template

  • XML declaration

  • Document Type declaration

  • Root element (required)

  • Child elements (any level of nesting)

  • Attributes

  • Literal text

  • Comments

  • Processing instructions

  • CDATA sections


Export xml template divided in 2

Export XML Template Divided in 2

Header Section

Optionally contains:

  • XML declaration (dialog)

  • Document type declaration (dialog)

  • Comments (dialog)

  • Processing instructions (dialog)

  • Root element (required)

  • Child elements (non-iterative)


Export xml template divided in 21

Export XML Template Divided in 2

Detail Section

Iterated for each row; can contain:

  • Detail (row) Start element

  • Child or sibling elements to the Detail Start element

  • Content and Attribute values (dialog)

    • DataWindow control references (dialog or drag-drop)

    • DataWindow Expressions (dialog)

  • Literal text

  • Comments, PIs, and CDATA sections


Attributes dialog

Attributes Dialog


View features

View Features

  • Item-specific context menus, label-editing & dialogs

  • Header/Detail marked by line across TreeView

  • Drag-and-drop from Control List View and Column Specification View

  • View-level menu

    • New

    • New Default

    • Open (dialog)

    • Save, SaveAs (dialog)

    • Delete


Default template

Default Template

Contains:

  • XML declaration

  • Root element (defaults to DataWindow name)

  • Detail Start element (defaults to DW name + “_row”)

  • Child elements of the Detail Start element named for each DataWindow column with content reference

  • Useful as starting point

  • Same structure assumed at runtime if no UseTemplate specified on XML export or import


Datawindow properties view

DataWindow Properties View


Datawindow properties in powerscript

DataWindow Properties in PowerScript

Export.XML.UseTemplate

Controls logical structure of XML data exported by DW

PowerBuilder dot notation:

dw_control.Object.DataWindow.Export.XML.UseTemplate

Describe and Modify argument:

“DataWindow.Export.XML.UseTemplate { = ‘value’ }”


Datawindow properties in powerscript1

DataWindow Properties in PowerScript

Export.XML.TemplateCount

Returns number of Templates saved for DataWindow

PowerBuilder dot notation:

dw_control.Object.DataWindow.Export.XML.TemplateCount

Describe argument:

“DataWindow.Export.XML.TemplateCount”


Datawindow properties in powerscript2

DataWindow Properties in PowerScript

Export.XML.Template[1..n].Name

Returns name of Template by array index (storage order)

PowerBuilder dot notation:

dw_control.Object.DataWindow.Export.XML.Template[1..n].Name

Describe argument:

“DataWindow.Export.XML.Template[” + n + “].Name”


Runtime template enumeration example

Runtime Template Enumeration Example

String ls_template_count, ls_template_name

Long l_template_count, i

l_template_count = &

Long(dw_1.Object.DataWindow.Export.XML.TemplateCount)

For i = 1 to l_template_count

ls_template_name = &

dw_1.Object.DataWindow.Export.XML.Template[i].Name

ddlb_1.AddItem(ls_template_name)

Next


Datawindow properties in powerscript3

DataWindow Properties in PowerScript

Export.XML.MetaDataType

Controls type of metadata to accompany exported XML

PowerBuilder dot notation:

dw_control.Object.DataWindow.Export.XML.MetaDataType

Describe and Modify argument:

“DataWindow.Export.XML.MetaDataType { = ‘value’ }”


Datawindow properties in powerscript4

DataWindow Properties in PowerScript

Export.XML.SaveMetaData

Controls location of generated metadata

PowerBuilder dot notation:

dw_control.Object.DataWindow.Export.XML.SaveMetaData

Describe and Modify argument:

“DataWindow.Export.XML.SaveMetaData { = ‘value’ }”


Methods to export xml

Methods to Export XML

DataWindow Painter

File…Save Rows As… menu item

Save as type: XML


Methods to export xml1

Methods to Export XML

SaveAs method

integer dwcontrol.SaveAs ( string filename,

saveastype saveastype,

boolean colheading )

SaveAsType


Datawindow properties in powerscript5

DataWindow Properties in PowerScript

Data.XML

String containing DataWindow data exported in XML

PowerBuilder dot notation:

dw_control.Object.DataWindow.Data.XML

Describe argument:

“DataWindow.Data.XML”


Datawindow properties in powerscript6

DataWindow Properties in PowerScript

Data.XMLSchema

String containing XML Schema generated from Template

PowerBuilder dot notation:

dw_control.Object.DataWindow.Data.XMLSchema

Describe argument:

“DataWindow.Data.XMLSchema”


Datawindow properties in powerscript7

DataWindow Properties in PowerScript

Data.XMLDTD

String containing DTD generated from Template

PowerBuilder dot notation:

dw_control.Object.DataWindow.Data.XMLDTD

Describe argument:

“DataWindow.Data.XMLDTD”


Importing xml data into datawindow

Importing XML Data into DataWindow

  • Analogous to XML export

  • Piggybacks off of Export XML Template to interpret the logical structure and DataWindow mapping of XML document to import

  • Uses SAX parser for performance

  • DataWindow Import methods enhanced


Datawindow properties in powerscript8

DataWindow Properties in PowerScript

Import.XML.UseTemplate

Controls logical structure of XML data imported by DW

PowerBuilder dot notation:

dw_control.Object.DataWindow.Import.XML.UseTemplate

Describe and Modify argument:

“DataWindow.Import.XML.UseTemplate { = ‘value’ }”


Methods to import xml

Methods to Import XML

long dwcontrol.ImportFile ( { saveastype importtype, }

string filename {, long startrow {, long endrow {, long

startcolumn {, long endcolumn {, long dwstartcolumn }}}}} )

long dwcontrol.ImportString ( { saveastype importtype, }

string string {, long startrow {, long endrow {, long

startcolumn {, long endcolumn {, long dwstartcolumn }}}}} )

long dwcontrol.ImportClipboard ( { saveastype importtype

{, long startrow {, long endrow {, long startcolumn {, long

endcolumn {, long dwstartcolumn }}}}}} )


Xsl fo generator

XSL-FO Generator

XSL Formatting Objects

  • Second part of XSL W3C Recommendation covering presentation of XML

  • Spec at http://www.w3.org/TR/xsl/slice6.html#fo-section

  • XSL-FO processors can render to PDF

    • Apache XML FOP Project

    • http://xml.apache.org/fop


Datawindow properties in powerscript9

DataWindow Properties in PowerScript

Data.XSLFO

String containing DataWindow data & presentation in XSL Formatting Objects

PowerBuilder dot notation:

dw_control.Object.DataWindow.Data.XSLFO

Describe argument:

“DataWindow.Data.XSLFO”


Pdf from fop

PDF from FOP


Sybase developer network sdn

Sybase Developer Network (SDN)

Additional Resources for Developers/DBAs

  • Single point of access to developer software, services, and up-to-date technical information:

    • White papers and documentation

    • Collaboration with other developers and Sybase engineers

    • Code samples and beta programs

    • Technical recordings

    • Free software

    • Join today: www.sybase.com/developer or visit SDN at TechWave’s Technology Boardwalk


  • Login