Use of XInclude

I would like to move our Oracle database processes to use liquibase but I don’t want to include trigger and package code inside the XML itself (for a start it is all in source control as it is a secondly I don’t want to prevent developers compiling code into the database manually - at least for now.)

Beyond the basic concepts I have no experience of using XML but I have come accross what appears to be the solution to my problem. It is “XInclude” which should allow me to include sql files in the XML. However I can’t get it to work. Has anyone else tried this? And if so can you provide an example showing how to go about it? Or am I barking up the wrong tree!!

The code I am trying to write looks like this (at the moment.) It is based on the walk through example but I have moved the departments_bi trigger code into a seperate file departments_bi.sql

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<databaseChangeLog xmlns=“http://www.liquibase.org/xml/ns/dbchangelog/1.9”
                  xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
                  xsi:schemaLocation=“http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd”>
   
       
          <xi:include href=“departments_bi.sql” parse=“text”/>
       
       
            drop trigger departments_bi
       
   

When I run this against liquibase I get a massive stack trace, I haven’t provided it as I think I am probably doing something fundamentally wrong but I can post it if it would help.

Can anyone point me in the right direction?

Thanks

flamangoes,

first issue, in your xml you haven’t defined xi namespace. IMO that’s why xml parser throws the exception.

second, you don’t need to use XInclude, more simple to use tag.

                       

see http://www.liquibase.org/manual/custom_sql_file for more information

Cheers, Oleg

Thanks I have tried it with the namespace and still couldn’t get it to work BUT I then tried your suggestion of sqlFile and that works perfectly.

Cheers