cvc-complex-type.2.3: Element 'createTable' cannot have character [children]

I took a look and didn’t see any obvious errors. I have seen this sort of error when the file is not saved with UTF-8 encoding, but the file I extracted did seem to have UTF-8 encoding. You might be able to get more information by running your command and adding “–logLevel=DEBUG” to get a better idea where in the changelog it is having problems. 

Basically, the error message is saying that liquibase can’t even parse the XML from the changelog. The XML parsing is done with a well-known XML parsing library, so the most likely cause is malformed or mal-encoded XML.

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Hi, I am trying to get started with liquibase and generated a change log from an existing database and tried to apply this changelog into an empty schema. but it fails with this error.

Not sure where to start, didn’t find any solution for this issue…

appreciate any help.

./liquibase --driver=com.mysql.jdbc.Driver --classpath=/deploy/back/deploy/current/lib/mysql-connector-java-5.1.13.jar --changeLogFile=/home/local/CAREZEN/rreddy/liquibase/careuat14.changelog.xml --url=“jdbc:mysql://10.192.100.21/test” --username=test --password=test update

Unexpected error running Liquibase: cvc-complex-type.2.3: Element ‘createTable’ cannot have character [children], because the type’s content type is element-only.

Thanks,

Ramki

Can you attach the changelog () you are working with?

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Hi Steve, Attaching the changelog here…

Thanks Steve, I see more information when running with DEBUG option…

Unexpected error running Liquibase: cvc-complex-type.2.3: Element ‘createTable’ cannot have character [children], because the type’s content type is element-only.

SEVERE 1/25/17 8:31 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 2300 column 23 of /home/local/CAREZEN/rreddy/liquibase/careuat14.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:1130)

        at liquibase.integration.commandline.Main.run(Main.java:188)

        at liquibase.integration.commandline.Main.main(Main.java:103)

Caused by: org.xml.sax.SAXParseException; lineNumber: 2300; 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:2957)

        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

 possible values:

so it didn’t like the new line characters in the comments…after removing those…it’s complaining of something else…

SEVERE 1/25/17 8:45 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 1440 column 23 of /home/local/CAREZEN/rreddy/liquibase/careuat14.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:1130)

        at liquibase.integration.commandline.Main.run(Main.java:188)

        at liquibase.integration.commandline.Main.main(Main.java:103)

Caused by: org.xml.sax.SAXParseException; lineNumber: 1440; columnNumber: 23; cvc-complex-type.2.3: Element ‘createTable’ cannot have character [children], because the type’s content type is element-only.

will keep looking…

but yeah DEBUG is somewhat helpful.

Thanks

Ramki

Steve, I am stuck trying to figure out what could be wrong with this line, actually that line doesn’t correspond to the exact line number within the file…

-Ramki

That worked Mark, changing the version from “1.1” To “1.0” helped to parse the XML without any errors.

I don’t know why it’s trying to convert default value of “CURRENT_TIMESTAMP”  for a TIMESTAMP column to a NOW() and failing…

the original definition for this table has TLM column defined as following:

TLM timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

liquibase is trying to transform it as follows and fails:

 TLM timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP

— error–

SEVERE 1/30/17 12:36 PM: liquibase: /home/local/CAREZEN/rreddy/liquibase/db.changelog.xml::1484939656104-1::root (generated): Invalid default value for ‘TLM’ [Failed SQL: CREATE TABLE test.ACCOUNT_PHONE_NUMBER (ID INT UNSIGNED AUTO_INCREMENT NOT NULL, PHONE_NUMBER VARCHAR(12) NOT NULL COMMENT ‘The phone number allocated to the account’, COMMUNICATION_ACCOUNT_ID INT UNSIGNED NOT NULL COMMENT ‘The communication account to which this phone number belongs to’, SMS_CAPABLE BIT(1) DEFAULT 0 NOT NULL COMMENT ‘This flag tells whether twilio number supports sms or not’, MMS_CAPABLE BIT(1) DEFAULT 0 NOT NULL COMMENT ‘This flag tells whether twilio number supports mms or not’, VOICE_CAPABLE BIT(1) DEFAULT 0 NOT NULL COMMENT ‘This flag tells whether twilio number supports voice or not’, STATUS ENUM(‘ACTIVE’, ‘INACTIVE’) DEFAULT ‘ACTIVE’ NOT NULL COMMENT ‘The status of the communication request’, STATUS_TLM datetime(6) NOT NULL COMMENT ‘The time the status got updated’, WHEN_CREATED datetime(6) NOT NULL COMMENT ‘The time this account is created’, TLM TIMESTAMP(19) DEFAULT NOW() NOT NULL, CONSTRAINT PK_ACCOUNT_PHONE_NUMBER PRIMARY KEY (ID))]

liquibase.exception.MigrationFailedException: Migration failed for change set /home/local/CAREZEN/rreddy/liquibase/db.changelog.xml::1484939656104-1::root (generated):

     Reason: liquibase.exception.DatabaseException: Invalid default value for ‘TLM’ [Failed SQL: CREATE TABLE test.ACCOUNT_PHONE_NUMBER (ID INT UNSIGNED AUTO_INCREMENT NOT NULL, PHONE_NUMBER VARCHAR(12) NOT NULL COMMENT ‘The phone number allocated to the account’, COMMUNICATION_ACCOUNT_ID INT UNSIGNED NOT NULL COMMENT ‘The communication account to which this phone number belongs to’, SMS_CAPABLE BIT(1) DEFAULT 0 NOT NULL COMMENT ‘This flag tells whether twilio number supports sms or not’, MMS_CAPABLE BIT(1) DEFAULT 0 NOT NULL COMMENT ‘This flag tells whether twilio number supports mms or not’, VOICE_CAPABLE BIT(1) DEFAULT 0 NOT NULL COMMENT ‘This flag tells whether twilio number supports voice or not’, STATUS ENUM(‘ACTIVE’, ‘INACTIVE’) DEFAULT ‘ACTIVE’ NOT NULL COMMENT ‘The status of the communication request’, STATUS_TLM datetime(6) NOT NULL COMMENT ‘The time the status got updated’, WHEN_CREATED datetime(6) NOT NULL COMMENT ‘The time this account is created’, TLM TIMESTAMP(19) DEFAULT NOW() NOT NULL, CONSTRAINT PK_ACCOUNT_PHONE_NUMBER PRIMARY KEY (ID))]

        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:619)

        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51)

        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:79)

        at liquibase.Liquibase.update(Liquibase.java:214)

        at liquibase.Liquibase.update(Liquibase.java:192)

        at liquibase.integration.commandline.Main.doMigration(Main.java:1130)

        at liquibase.integration.commandline.Main.run(Main.java:188)

        at liquibase.integration.commandline.Main.main(Main.java:103)

Here is the changeset xml for that table:

 

       

           

               

           

           

               

           

           

               

           

           

               

           

           

               

           

           

               

           

           

               

           

           

               

           

           

               

           

           

               

           

       

Good morning, I was experiencing this issue also with the dbchangelog-3.5.xsd using generated xml from liquibase.  I downloaded the xsd and validated it against the file (visual studio  adding ti to the xml schema set) and the error produced was that it was expecting xml version=“1.0”  I had xml version=“1.1”.  After the change, I no longer receive the error.