# Use of XInclude

**URL:** https://forum.liquibase.org/t/use-of-xinclude/816
**Category:** General Discussion
**Created:** [September 21, 2010, 10:30pm UTC](https://forum.liquibase.org/t/use-of-xinclude/816 "2010-09-21T22:30:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![flamangoes](https://avatars.discourse-cdn.com/v4/letter/f/958977/32.png) [@flamangoes](https://forum.liquibase.org/u/flamangoes)
#### Post date: [September 21, 2010, 10:30pm UTC](https://forum.liquibase.org/t/use-of-xinclude/816/1 "2010-09-21T22:30:00Z")

</div>

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”](http://www.liquibase.org/xml/ns/dbchangelog/1.9%22)  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance”](http://www.w3.org/2001/XMLSchema-instance%22)  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xsi:schemaLocation=“[http://www.liquibase.org/xml/ns/dbchangelog/1.9](http://www.liquibase.org/xml/ns/dbchangelog/1.9) [http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd”\>](http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd%22>)  
&nbsp; &nbsp;   
&nbsp; &nbsp; &nbsp; &nbsp;   
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \<xi:include href=“departments\_bi.sql” parse=“text”/\>  
&nbsp; &nbsp; &nbsp; &nbsp;   
&nbsp; &nbsp; &nbsp; &nbsp;   
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drop trigger departments\_bi  
&nbsp; &nbsp; &nbsp; &nbsp;   
&nbsp; &nbsp;

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

---

<div class="post-metadata">

### Author: ![taranenko](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@taranenko](https://forum.liquibase.org/u/taranenko)
#### Post date: [September 21, 2010, 10:30pm UTC](https://forum.liquibase.org/t/use-of-xinclude/816/2 "2010-09-21T22:30:00Z")

</div>

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.

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 

see [http://www.liquibase.org/manual/custom\_sql\_file](http://www.liquibase.org/manual/custom_sql_file) for more information

Cheers, Oleg

---

<div class="post-metadata">

### Author: ![flamangoes](https://avatars.discourse-cdn.com/v4/letter/f/958977/32.png) [@flamangoes](https://forum.liquibase.org/u/flamangoes)
#### Post date: [September 21, 2010, 10:30pm UTC](https://forum.liquibase.org/t/use-of-xinclude/816/3 "2010-09-21T22:30:00Z")

</div>

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
