DiffResult.printChangeLog generates xmlns="" at each element

I’m trying to use Liquibase embedded in code.
The DOM document builder is Xerces. (I guess this is the default)
The (identity) transformer from XMLDefaultXMLWriter that serializes to a PrintStream or file is Saxon 9.2.1 (this is probably not the default, it’s used in my code; haven’t tried with the default)
Using Java 6
Using Liquibase code snapshot 2.0RC8

DiffResult.printChangeLog generates xmlns="" at each element in the output xml; which invalidates the xml of the changelog file.

    <?xml version="1.0" encoding="UTF-8"?> http://www.liquibase.org/xml/ns/dbchangelog"                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

I’ve been trying to workaround this validation issue; and found one way to achieve this; that is to replace the calls createElement(“databaseChangeLog”); by createElementNS(“http://www.liquibase.org/xml/ns/dbchangelog”, “databaseChangeLog”); (in both DiffResult and XMLChangeLogSerializer)

to make those xml elements namespace aware.

This solved the issue of the xmlns="" for me. The xmlns="" are no longer present; and the xml is now validating.

I’m new to liquibase but trying to find my way through it. Not sure if this was a bug or not; and whether this is a bugfix.
Feedback is welcomed.

It has worked with the default XML parser, but I’ll commit the change so it works with yours as well.


Great !