13.07.2013 Views

dans des entrepôts de données XML - CoDE - Université Libre de ...

dans des entrepôts de données XML - CoDE - Université Libre de ...

dans des entrepôts de données XML - CoDE - Université Libre de ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPITRE 7. RÉALISATION DE L’ETL 49<br />

}<br />

}<br />

}<br />

{<br />

children := no<strong>de</strong> -> childNo<strong><strong>de</strong>s</strong> ;<br />

// list of children no<strong><strong>de</strong>s</strong><br />

foreach ( child in children )<br />

{<br />

parseNo<strong>de</strong> ( child , xpath );<br />

// recursive call<br />

}<br />

}<br />

7.1.10 Parsing <strong>de</strong> la structure définie <strong>dans</strong> un fichier XSD<br />

La fonction définie <strong>dans</strong> le listing 7.9, permet d’extraire la structure <strong>de</strong> document défini<br />

<strong>dans</strong> un fichier XSD. Cette fonction est notamment utilisée pour créer une visionneuse (viewer)<br />

<strong><strong>de</strong>s</strong> schémas sans montrer le fichier XSD comme tel.<br />

Listing 7.9 – Parsing d’une structure définie <strong>dans</strong> un fichier XSD<br />

function parseSchema ()<br />

{<br />

" initialization of the document ";<br />

" initilization of xpath ";<br />

query :="// xs: schema /xs: element [ @name ]";<br />

// root element<br />

xpathquery := xpath -> query ( query );<br />

// run query<br />

if( xpathquery is not NULL ) then<br />

{<br />

" begin creation of viewer ";<br />

rootElem := xpathquery -> item (0) ;<br />

parseNo<strong>de</strong> ( rootElem , xpath );<br />

" end creation of viewer ";<br />

}<br />

}<br />

7.1.11 Création <strong>de</strong> l’interface <strong><strong>de</strong>s</strong> correspondances<br />

L’interface <strong><strong>de</strong>s</strong> correspondances est la fenêtre <strong>dans</strong> laquelle l’utilisateur déterminera les<br />

transformations à effectuer. Nous laissons au programmeur la liberté <strong>de</strong> créer l’interface <strong>de</strong> son<br />

choix. Dans notre prototype, nous générons un formulaire illustré à la figure 6.1. La fonction<br />

extractElem définie <strong>dans</strong> le listing 7.7 peut ai<strong>de</strong>r à obtenir la liste <strong><strong>de</strong>s</strong> éléments et <strong><strong>de</strong>s</strong> attributs<br />

définis <strong>dans</strong> les schémas XSD source et <strong><strong>de</strong>s</strong>tination.<br />

7.1.12 Compilation d’un processus ETL<br />

Dans ce paragraphe, nous illustrons une manière <strong>de</strong> rassembler (compiler) les différentes<br />

fonctions définies précé<strong>de</strong>mment pour réaliser un processus ETL. C’est ici où nous faisons<br />

usage du fichier XSLT généré au chapitre 6 (p. 35).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!