0

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>
adrock
  • 1
  • 1
  • 3

4 Answers4

2

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.

RikH
  • 151
  • 1
  • 8
1

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.

Raidri
  • 17,258
  • 9
  • 62
  • 65
ajimenez
  • 86
  • 3
0

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.

SteveDonie
  • 8,700
  • 3
  • 43
  • 43
  • Thanks for the reply! I have checked this in Notepad++. Nothing looks different about this table compared to others in the same file. And if I pull it out, it works fine. The most curious thing is that I can migrate using this same file into PostgreSQL with no errors. – adrock Jul 29 '16 at 22:29
  • I have also tried `grep -P "[\x80-\xFF]"` which is supposed to give me the line numbers of any non-ASCII characters. This returns no results. – adrock Jul 29 '16 at 22:53
  • Which line is number 144? try identifying the offending character. Which xsd file are you using in your xml? – orikosaki Jul 31 '16 at 20:02
0

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