Solved

How to specify multiple xfMap files to an XML reader


Userlevel 3
Badge +17
Hi,

 

 

I'm trying to read an XML document using multiple xfMap files. First, I defined all schemas in single xfMap file. When specify the file path as the XML reader parameter, there are no problem. However, after dividing the definition into 2 xfMap files, when I specify those file paths to the reader parameter, the FME workbench detects an error:

 

-----

 

Opening the XML reader with source dataset 'C:/tmp/sample01/sample01.xml'

XML Parser error: 'Error at file:'' line-0 column:0 message:unable to open primary document entity 'C:\\tmp\\sample01\\xfmap_sample01_1.xml C:\\tmp\\sample01\\xfmap_sample01_2.xml''

An error ocurred while attempting to parse the xfMap document 'C:\\tmp\\sample01\\xfmap_sample01_1.xml C:\\tmp\\sample01\\xfmap_sample01_2.xml'

XML Parser error: 'Error at file:'' line-0 column:0 message:unable to open primary document entity 'C:\\Program Files\\FME 2013 SP2\\xfmap/xfmap_sample01_2.xml''

An error ocurred while attempting to parse the xfMap document 'C:\\Program Files\\FME 2013 SP2\\xfmap/xfmap_sample01_2.xml'

-----

 

When using "xfmap_sample01_1.xml" or "xfmap_sample01_2.xml" individually, I succeeded to add the reader.

 

The document says "Specifies the location of the xfMap document. Multiple xfMaps may be specified here", so I believe that I can use multiple xfMap files simultaneously. How can I use multiple xfMap files in an XML reader?

 

 

Takashi
icon

Best answer by fmelizard 11 July 2013, 08:27

View original

10 replies

Userlevel 4
Badge +13
Hi Takashi,

 

It this more of a curiosity question ? I imagine that since one xfmap works, there is no reall rush about it.

 

Also I was wondering if you tried to specify the xfmap files with a feature type filter, or reading the all directory (as shown in the documentation).

 

 

Itay
Userlevel 3
Badge +17
Hi Itay,   Thank you for the response. When I specified a directory containing 2 xfMap files as the documentation describes, got the similar error again. ---

Opening the XML reader with source dataset 'C:/tmp/sample01/sample01.xml'

XML Parser error: 'Error at file:'' line-0 column:0 message:unable to open primary document entity 'C:\\tmp\\sample01\\xfmaps\\*.xml''

An error ocurred while attempting to parse the xfMap document 'C:\\tmp\\sample01\\xfmaps\\*.xml'

XML Parser error: 'Error at file:'' line-0 column:0 message:unable to open primary document entity 'C:\\Program Files\\FME 2013 SP2\\xfmap/*.xml''

An error ocurred while attempting to parse the xfMap document 'C:\\Program Files\\FME 2013 SP2\\xfmap/*.xml'

--- About the FeatrueTypeFilter, I couldn't understand how to apply that...   Actually there are several XML schemas each of which has common part and specific part, so I'm planning to use two xfMap files (i.e. a common xfMap and a specific xfMap) to read the XML documents. I'm in the testing phase to make sure whether the plan can be realized.

 

If there is no way to use multiple xfMap files anyway, I would look for other approaches.

 

Thanks for your support.

 

 

Takashi
Userlevel 3
Badge +17
Hi,

 

 

I found that the XMLFeatureMapper can read an XML document with multiple xfMap files. The FeatureTypeFilter can be used after reading.   I want to do this with the XML reader, but not found the way anyway. Does not the XML reader support multiple xfMaps after all?

 

Takashi
Userlevel 4
Badge +13
Hi Takashi,

 

 

Good to know that there is a workaround in case of need, but I suppose the neatest option should be the XML reader.

 

I would notufy safe about the issue.

 

 

Regards,

 

Itay
Userlevel 3
Badge +17
Hi Itay,

 

 

I've sent a request to the Safe support a minute ago. I hope to get a good information from Safe :-)

 

 

Takashi
Userlevel 4
Badge +13
Hi Takahshi,

 

I guess there is an issue in the reader and I have run this by the developer but it looks like you have a work-around using the XMLFeatureMapper. 

 

 

By the way, our recommend approach these days is to use either the "Feature Paths Configuration" in the XML reader or use the TEXT File reader and then the XMLFlattener transformer.  A couple of article to have look at on this approach:

 

 

Hope this helps 

 

Ken
Userlevel 3
Badge +17
Hi Ken,

 

 

Thank you for your reply.

 

I know that the "Feature Paths Configuration" is a quick solution in many

 

cases.

 

However,  my XML schemas are relatively complex, I have to read some

 

structures as multidimentional lists - e.g. "polygon.interior{}.ring.segment{}.idref". What is worse, some documents

 

have interior elements, others don't have.

 

This is just an example, there are many situations like this in my project.

 

I think "Feature Paths" is slightly lack of ability to read documents having such a complex schema, so I planned to use xfMaps.

 

Anyway, since I found a workaround with XMLFeatureMapper, I can proceed the project. It's an enough solution that I knew the current XML reader doesn't support multiple xfMaps.

 

I hope the XML reader will be improved asap.

 

 

Regards,

 

 

Takashi
Userlevel 4
Badge +13
The problem with not being able to specify multiple XfMap files in the XML reader will be fixed in FME 2014 shortly.  

 

 

In the meantime it might work to delimit them with semi-colons like this 

 

file1path ; file2path 

 

 

Thanks 

 

Ken 

 

Userlevel 3
Badge +17
Hi Ken,

 

 

Great! My XML reader worked expectedly using two xfMaps if I delimit the xfMap file paths with a semi-colon.

 

Thank you for the good news.

 

Takashi
Userlevel 3
Badge +17
I confirmed that multiple xfMap files can be specified in the XML Reader without any delimiter, in FME 2014 beta build 14233. Thanks.

Reply