Skip to main content
Question

1 reader to multiple writers based on external XML?

  • November 14, 2013
  • 7 replies
  • 24 views

Forum|alt.badge.img
Hello all,

 

 

I have the following database:

 

 

Table_source

 

ID,CATEGORY,TYPE,REMARK

 

1,TEST,TYPE 1,NO REMARK

 

 

What I need to do is export this to 2 XML files

 

Table_export_1

 

ID,CATEGORY

 

1,TEST

 

 

Table_export_2

 

ID,TYPE,REMARK

 

1,TYPE 1,NO REMARK

 

 

The problem is that I can't find how to do this, I've tried with a SchemaMapper, but I always get a 1:1 result instead of a 1:n result.

 

 

Can anyone help me out?

 

 

Thanks in advance.
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

Forum|alt.badge.img
  • Author
  • November 14, 2013
Ack, sorry messed up on the topic. 

 

 

It has be based on an external Excel or CSV, and the output should be multiple XML files.

takashi
Celebrity
  • November 14, 2013
Hi,

 

 

How about using two writers? Just branch the feature flow into two streams, and make each writer write required attributes only.

 

 

Takashi

fmelizard
Safer
Forum|alt.badge.img+21
  • Safer
  • November 14, 2013
Hi,

 

 

Yes Takashi's suggestion is the easiest and most efficient, its just a matter of removing/keeping the correspoinding attribues.

 

 

Itay

Forum|alt.badge.img
  • Author
  • November 14, 2013
The thing is, the writers are dynamic. If I add a field in the mapping Excel, I want it to be mapped to the desired XML, and to be added as an attribute.

fmelizard
Safer
Forum|alt.badge.img+21
  • Safer
  • November 14, 2013
Have you tried adding the xls as a resource and use it in the writer dynamic schema definition?

takashi
Celebrity
  • November 14, 2013
The approaches I can think of are:

 

 

1. Create custom formats to extract schema subsets. Dynamic schema partial merge from 2 data sources http://fmepedia.safe.com/AnswersQuestionDetail?id=906a0000000cokTAAQ Extracting a schema subset for dynamic schemas http://fmepedia.safe.com/articles/How_To/Extracting-a-schema-subset-for-dynamic-schemas   2. Create tables defining schemas and use them as resources (similar to Itay's suggestion). Schema from Details Contained Within a Dataset (Example 3) in Dynamic Schema Examples http://fmepedia.safe.com/articles/Samples_and_Demos/Dynamic-Schema-Examples-FME2011   By the way, how do you determine which writer should be used to write the added attribute?

Forum|alt.badge.img
  • Author
  • November 14, 2013

My idea was to use an Excel file with the mapping:

 

 

Source_feature,Target_feature,attribute,attribute_type

 

Table_source,Table_export_1,ID,fme_decimal(10,0)

 

Table_source,Table_export_1,CATEGORY,fme_varchar(30)

 

Table_source,Table_export_2,ID,fme_decimal(10,0)

 

Table_source,Table_export_2,TYPE,fme_varchar(30)

 

Table_source,Table_export_2,REMARK,fme_varchar(50)

 

 

Thus mapping the features and attributes. I don't have access to the target XML files, so I can't use them as a template. If the Excel changes, I'll receive a new one and I'll have to run the FME script again.