How to generate source types for XML?

#1

I have an XML file with deeply nested elements. In order for the platform to understand how to parse it, I need to create source types. Can the platform generate source types based on an XML file?

1 Like

Load XML after creating types form inferType
#2

Yes.

  1. Curl your file to the environment (likely to be in S3)

  2. Get the curled file as a S3File type or File type. For example:
    var myFile = S3.listFiles().at("files")[1]

  3. Use inferType API to get source types. For example:
    myFile.inferType('myFileNamePrefix','XML',1)

  4. Download the C3 type files.
    How to write contents of inferred types to C3 type files?

Please read documentation of the methods before using the examples!

2 Likes

#3

To be clear inferType method takes InferTypeSpec as input - @see c3ShowType(InferTypeSpec) for more details

0 Likes