Error: Please select a valid XML file. Caused by oracle.tip.tools.adapters.cloud.api.CloudAdapterException. Start of root element expected.
Explanation – For an Integration requirement with JDE we received this Source sample xml file from one of our European customers. When we open this xml file and validate data and structure, we could not find anything wrong with it still OIC is throwing an error.
Solution –
- Make a copy of this file and open in Notepad++ or any other editor which allows you to change file’s encoding.
- Change it’s encoding to UTF-8 and now let’s provide this as sample file in OIC to generate schema
- Using modified xml file, OIC generates schema successfully.
At this stage if we complete the integration, activate and test, integration will fail for actual file but can read modified file (UTF-8 encoded file)Modified File read is successfulOriginal file read fails.
Which means that schema still cannot handle BOM encoded files. Let's move ahead and modify schema. - Edit Adapter endpoint configuration and modify schema manually. To do this Edit Adapter endpoint config, Click on Summary and then click on Schema. You will be now able to see NXSD schema generated for XML file.
- Copy this schema into Notepad++ and add nxsd:parseBom="true" property in xsd:schema element. Save this file. Finally, it will look like this –
- Now, navigate back to Schema tab and choose XML Schema (XSD) Document option for defining schema. Choose schema file saved in previous steps. Complete adapter configuration.
- That’s it. Activate and test integration for both files. Both files will be processed successfully with this schema.Modified file read is successfulAlso, able to read Original file
To summarize, If you are facing an error while generating schema for a xml file and you see that there is no issue with structure or content of the file then investigate other areas and if you end up with BOM encoded file then use schema attribute nxsd:parseBom="true" to read this type of files.