Hello everyone,
I want to create a flow which writes my current location to a file. To do so, I saw there is already an existing solution how to save location information: GPX-files, which are based on XML (see: https://en.wikipedia.org/wiki/GPS_Exchange_Format).
So I want to know, if there is a good solution how to generate XML-files using automagic? As far as I know there is only a way to append information to a file, but this would not work for XML-files.
Thanks a lot in advance!
Best regards
Dominik
XML-Document generation by Automagic
Moderator: Martin
Re: XML-Document generation by Automagic
Hi,
You could either store the locations in a global list and write the XML only on demand or you could append the XML fragments without "closing" the XML and then copy the XML to another file and close it:
The flow would first write following "header" to temp_gpx.xml:
an action would then append such an XML fragment to the file for each location:
then use an action Copy File: temp_gpx.xml to final_gpx.xml to copy the file and append following text to properly close the XML:
Regards,
Martin
You could either store the locations in a global list and write the XML only on demand or you could append the XML fragments without "closing" the XML and then copy the XML to another file and close it:
The flow would first write following "header" to temp_gpx.xml:
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" creator="Oregon 400t" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd">
<metadata>
<link href="http://www.garmin.com">
<text>Garmin International</text>
</link>
<time>2009-10-17T22:58:43Z</time>
</metadata>
<trk>
<name>Example GPX Document</name>
<trkseg>
Code: Select all
<trkpt lat="47.644548" lon="-122.326897">
<ele>4.46</ele>
<time>2009-10-17T18:37:26Z</time>
</trkpt>
Code: Select all
</trkseg>
</trk>
</gpx>
Regards,
Martin
-
- Posts: 3
- Joined: 01 Jul 2016 12:12
Re: XML-Document generation by Automagic
Hi Martin,
thanks for that solution! I will try it like this
Best regards
Dominik
thanks for that solution! I will try it like this
Best regards
Dominik