0

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.

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

1 Comment

The part I'm trying to figure out is how the XSD could handle this, is there a special attribute or way to define the element to handle only space fields?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.