Question

XML Files - Bang head on desk here

  • 27 April 2024
  • 3 replies
  • 29 views

Badge +5

Starting soon I will receive about 150 XML files each with a different schema but the element name is include in the file name.  I have many ways to use a single FME workspace to process these files dynamically but have been unsuccessful.  

I figured using a Directory File reader and passing the file names to FeatureReader setup as XML then saving to a Dynamic Writer to a database.  No joy.

 

What am I missing for something so simple.


3 replies

Userlevel 4
Badge +18

I usually read xml as text file (don't forget the checkbox read whole file as single feature). The XML reader is always complaining about all kinds of missing information.

What is the goal of reading and writing the XML? Do you need to extract or convert?

 

 

Badge +5

@jkr_wrk 

Thanks for the reply.  Ultimately, need to update data in our Enterprise database using the XML files.  I have it working using manually configured transformers for each file but would like to clean this up as sometimes I only need to update a single file and other times all of them because of schema changes.  Also the actual number and names of the XML files change so I am looking for a more dynamic solution.

You note you read the XML as a text file.  Can you explain that process in a little more detail.  Right now I am using a Directory File reader to pass the path to the FeatureReader configured as a XML reader then writing to a database.  How do you get the schema from the XML data to pass to the database?

Ultimately I would like to be able to call a dynamic FME workspace from Python or a Workspace Runner to process the files needed or in batches.  Please also note, other transformers will be included in the workspace to remove some attributes, process dates, apply some filtering, etc.  Just trying to get it to work for now.

 

Userlevel 4
Badge +18

If you have it working for a single file you are already on the right path.

If your process will be using a WorkspaceRunner later in the process it's good to know that upfront.

I never use Readers and Writers in my workbenches except when the FeatureReader does not work the same, in rare occasions.

So I start with a Creator → FeatureReader (directoryfilepath) → FeatureReader (XML)

What changes do you need to make when configuring it for every file?

Reply