0
votes

I've seen this similar topic before, but without a resolution.

http://forum.liquibase.org/topic/liquibase-validation-can-we-turn-it-off

The problem is a validation error that ONLY happens using "migrate" on SQL Server. The same file can be used to create the schema in PostgreSQL. Why does it have a problem with SQL Server? The change log was generated from SQL Server, but can't be used to migrate the schema to a different database on the same host.

Please help!!

The short version of the error is this...

cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only

The full stack trace is this...

SEVERE 7/27/16 6:14 PM: liquibase: cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only. liquibase.exception.ChangeLogParseException: Error parsing line 144 column 23 of mssql-confluencetest-changelog.xml: cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only. at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:114) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17) at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:229) at liquibase.Liquibase.update(Liquibase.java:202) at liquibase.Liquibase.update(Liquibase.java:192) at liquibase.integration.commandline.Main.doMigration(Main.java:1126) at liquibase.integration.commandline.Main.run(Main.java:184) at liquibase.integration.commandline.Main.main(Main.java:103) Caused by: org.xml.sax.SAXParseException; lineNumber: 144; columnNumber: 23; cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:458) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3237) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3200) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3160) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3062) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2140) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:859) at com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl.scanEndElement(XML11NSDocumentScannerImpl.java:814) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) at com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl.next(XML11NSDocumentScannerImpl.java:857) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648) at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:106) ... 7 more

This is the problem XML...

<changeSet author="amartin (generated)" id="1469664903727-11" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<createTable tableName="AO_5FB9D7_AOHIP_CHAT_LINK">
    <column name="ADDON_TOKEN_EXPIRY" type="datetime"/>
    <column name="API_URL" type="nvarchar(255)"/>
    <column name="CONNECT_DESCRIPTOR" type="ntext"/>
    <column defaultValueNumeric="0" name="GROUP_ID" type="int"/>
    <column name="GROUP_NAME" type="nvarchar(255)"/>
    <column autoIncrement="true" name="ID" type="int">
        <constraints primaryKey="true" primaryKeyName="pk_AO_5FB9D7_AOHIP_CHAT_LINK_ID"/>
    </column>
    <column name="OAUTH_ID" type="nvarchar(255)"/>
    <column name="SECRET_KEY" type="nvarchar(255)"/>
    <column name="SYSTEM_PASSWORD" type="nvarchar(255)"/>
    <column name="SYSTEM_TOKEN_EXPIRY" type="datetime"/>
    <column name="SYSTEM_USER" type="nvarchar(255)"/>
    <column name="SYSTEM_USER_TOKEN" type="nvarchar(255)"/>
    <column name="TOKEN" type="nvarchar(255)"/>
</createTable>
</changeSet>
4

4 Answers

1
votes

I've the same error: using java 1.7_55, Centos OS, and liquibase 3.5.3.

Updating to java 1.7_80 solves the problem.

1
votes

I just ran into the same issue.

  • Upgrading to higher Java version was not an option.
  • Splitting into smaller files didn't work.
  • File was properly UTF-8 encoded / cleaned as per this answer.

Turned out I only had to change XML version from 1.1 to 1.0:
<?xml version="1.0" encoding="UTF-8"?>

Solution found on the Liquibase forums.

0
votes

You may have some characters in your changelog that are outside the standard ASCII character set. In particular, I have seen this happen when there were things like "curly quotes" in stored procedures referenced as external files. It may also be the case that the line/column referenced in the stack trace are NOT where the actual problem characters are.

Check the header of the changelog XML and see what the encoding is. Typically it is UTF-8. Use a tool like Notepad++ to check the encoding of any supporting files.

0
votes

I had the same error and fixed it by splitting my *.xml file into several smaller files.