"Validation error: unexpected content" error while using REST and JSON plugin 2.0.1.
book
Article ID: KB0082741
calendar_today
Updated On:
Products
Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON
2.0.1, 2.0.0 HF7
Description
While using Parse JSON activity of TIBCO ActiveMatrix BusinessWorks Plugin for REST and JSON plugin 2.0.1 with Schema type as XSD, Staxon and output validation option checked, customer may see the following validation error:
<?xml version = "1.0" encoding = "UTF-8"?> <ns0:ErrorReport xmlns:ns0 = "http://www.tibco.com/pe/EngineTypes"> <StackTrace>Job-17000 Error in [TestStaxon.process/Parse JSON] An error occurred while validating output: validation error: unexpected content "user_root"; expected "{http://www.tibco.com/schemas/TestStaxon/Schema.xsd}user_root" ({com.tibco.xml.validation}COMPLEX_E_UNEXPECTED_CONTENT) at /{http://www.tibco.com/namespaces/tnt/plugins/json}ActivityOutputClass[1]/user_root[1] com.tibco.xml.validation.exception.UnexpectedElementException: unexpected content "user_root"; expected "{http://www.tibco.com/schemas/TestStaxon/Schema.xsd}user_root" at com.tibco.xml.validation.state.a.a.a(CMElementValidationState.java:502) at com.tibco.xml.validation.state.a.a.a(CMElementValidationState.java:296) at com.tibco.xml.validation.state.driver.ValidationJazz.c(ValidationJazz.java:993) at com.tibco.xml.validation.state.driver.ValidationJazz.b(ValidationJazz.java:898) at com.tibco.xml.validation.state.driver.ValidationJazz.endAttributes(ValidationJazz.java:783) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:87) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:92) at com.tibco.xml.validation.state.glue.XmlTreeNodeValidationDriver.xmlTreeNode(XmlTreeNodeValidationDriver.java:129) at com.tibco.xml.xdata.bind.BindingRunner.validate(Unknown Source) at com.tibco.plugin.json.activities.JSONParserActivity.eval(JSONParserActivity.java:231) at com.tibco.pe.plugin.Activity.eval(Unknown Source) at com.tibco.pe.core.TaskImpl.eval(Unknown Source) at com.tibco.pe.core.Job.a(Unknown Source) at com.tibco.pe.core.Job.k(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.a(Unknown Source) at com.tibco.pe.core.JobDispatcher$JobCourier.run(Unknown Source)
Issue/Introduction
"Validation error: unexpected content" error while using REST and JSON plugin 2.0.1.
Environment
Product: TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON
Version: 2.0.0 HF7 or 2.0.1
OS: All supported Operating Systems
Resolution
The process fails because the namespace from the schema is not preferred or applied in the generated XML of parse JSON. For enabling the prefered namespace from the schema option, set the property "java.property.com.tibco.plugin.restjson.json2xml.preferNamespaceFromSchema" in tra with value "true".