Skip to main content
Question

Mass export of fields from xml to db

  • September 4, 2013
  • 4 replies
  • 26 views

frazucca
Contributor
Forum|alt.badge.img
Hi at all

 

after successufll (tank to Itay and Takashi) managed the spatial conversion of xml to  shape/kml/postgis  I need other suggestions on how manage

 

In essence, I would bring in the db (both ESRI geodatabse or postgis) a large part of the fields in the XML linking to their spatial compontent .

 

How can I manage it in a few steps (I have a thousand of xml with same schema)?

 

 

 

TIA

 

best regards

 

fz
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.

4 replies

takashi
Celebrity
  • September 5, 2013
Hi,

 

 

Are you looking for a way to read thousands xml files at one run-time? If so, I think the quickest way is to use wildcard (*) in the source dataset parameter of the XML reader. For example:

 

C:\\data\\*.xml

 

or if the files are saved in some sub-directories:

 

C:\\data\\**\\*.xml

 

 

Takashi

frazucca
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • September 5, 2013
Hi Takashi

 

I actually  badly explained my request:  no problem for read multifiles at prompt (thank). Rather I wish import all the field inside each xml (apart the spatial ones) inside a db (may be MsAccess or postgres/postgis or so on....).

 

At what I need  to pay attention?

 

 

thank

 

fz

takashi
Celebrity
  • September 5, 2013
Hi fz,

 

 

Assume you are using "Feature Paths" option to read XML.

 

When you specify an XML element to "Elements To Match" parameter of the XML reader, the reader generates a feature type; the feature will contain attributes corresponding to all the XML elements and attributes in the specified element.

 

For the sample XML in your previous post, if you specify "identificationInfo", the feature will have these attributes:

 

MD_DataIdentification.citation.CI_Citation.title.CharacterString = AST_L1A

 

MD_DataIdentification.citation.CI_Citation.date{0}.CI_Date.date.DateTime = 2010-02-01T16:38:12.700Z

 

...

 

etc.   Although these attribute names are very long, there are no differences from attributes of a feature read by other format readers. You can write them into any destination dataset after renaming (and transforming if necessary) appropriately.

 

See also these documentations to learn more how "Feature Paths" works:

 

Reading XML - Simple Approach using Feature Paths http://fmepedia.safe.com/articles/How_To/Reading-XML Reading Complex XML or GML using the XMLFlattener

 

http://fmepedia.safe.com/articles/Samples_and_Demos/Reading-Complex-XML-or-GML-using-the-XMLFlattener

 

 

Additionally, when you specify two or more XML elements to "Elements To Match", the XML reader generates multiple feature types. In such a case, you can merge features from the same xml file using FeatureMerger (specify "fme_basename" or "fme_dataset" as the join attribute). Hope this helps.

 

Takashi

fmelizard
Safer
Forum|alt.badge.img+21
  • Safer
  • September 5, 2013
Hi,

 

 

In addition to Takashi's answer there is lots to see about XML in the FME Channel. XML is after all one of Don's favourite formats.