Reputation: 1
I have a json file with the following snippet
{
"brandName": "b1Name",
"brandDesc": "b1Desc",
"brandId": "75",
"storeName": " "
},
{
"brandName": "b2Name",
"brandDesc": "b2Desc",
"brandId": "81",
"storeName": null
},
And for mapping purposes, the following XSD file is created
<?xml version = '1.0' encoding = 'UTF-8'?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://TargetNamespace.com/BrandListReference_getBrands_response"
targetNamespace="http://TargetNamespace.com/BrandListReference_getBrands_response"
elementFormDefault="qualified" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" nxsd:version="JSON"
nxsd:jsonTopLevelArray="true" nxsd:encoding="UTF-8">
<xsd:element name="brands">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="brand" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="brandName" type="xsd:string"/>
<xsd:element name="brandDesc" type="xsd:string"/>
<xsd:element name="brandId" type="xsd:integer"/>
<xsd:element name="storeName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:annotation xmlns="">
<xsd:appinfo>NXSDSAMPLE=</xsd:appinfo>
<xsd:appinfo>USEHEADER=false</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
Translation Failure. Failed to translate JSON to XML. cannot normalize! The incoming data does not conform to the NXSD schema. Please correct the problem.
After checking the JSON and nulling storeName in the first element transformation works fine. Is there a way to handle spaces only string values? As I have no control over the data provided in the JSON file.
Upvotes: 0
Views: 159
Reputation: 171
Befor insert to target table in Mapping(Interface), you use Component Split to split data to 2 target. If trim(col) is null data go to error_table If trim(col) is not null data go to target_table
Upvotes: 0