I execute query on my postgresdb to get result as a json: description is here http://rextester.com/ZULI42144

It looks nice but now I would like to convert it to xml. I decided to use fme to query postgres just like in example and now I have noe idea how to convert the result to xml and write it to file.

Also talking about json which I also need (I need result in JSON and XML format) what I achieved is that I simply executed postgres query end then wrote results using simple text writer so I suppose that fme doesnt really know that the query result is a JSON :)

  • What do you need the xml file for? A web app?
    – Mapperz
    Feb 15 '17 at 16:17

I think the better idea would be to query the postgres db directly with FME, rather than submitting a query that returns JSON. Because a direct JSON to XML conversion - once you're already in the workspace - is going to be complex. Better to just read the postgres as "FME features" and convert them to XML.

Once you have that, just add an XML writer (or a FeatureWriter transformer). That will write XML output for you. If you need a specific schema then set that in the writer parameters, along with any other settings, stylesheets, etc.

I made a quick movie demo here: https://www.screencast.com/t/Sb0jAxSFOh


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.