I plan to adopt once and for all handy a tool for handling the creation of gpx files.
I believe SimpleStorage which is a OmniXML based storage suited for easy XML data management, data storage and data interchange beetween systems fits it.
Here is an (incomplete) snippet to generate a bare bone gpx file that way :
function CreateGpx: ISimpleStorage;
const
versionStr = '1.1';
creatorStr = 'MyGpxCreatorSSway';
xmlnsStr = 'http://www.topografix.com/GPX/1/1';
xmlns_xsiStr = 'http://www.w3.org/2001/XMLSchema-instance';
xsiStr: string = xmlnsStr+' '+
xmlnsStr+'/gpx.xsd';
begin
Result := CreateStorage('gpx');
CreateBuilder(Result).Construct(
[
AddAttr('xmlns',xmlnsStr),
AddAttr('version',versionStr),
AddAttr('creator',creatorStr),
AddAttr('xmlns:xsi',xmlns_xsiStr),
AddAttr('xsi:schemaLocation',xsiStr),
//
AddElement('metadata',
[
AddElement('bounds',
[
AddAttr('minlat','90.00000000'),
AddAttr('minlon','180.00000000'),
AddAttr('maxlat','-90.00000000'),
AddAttr('maxlon','-180.00000000')
]),
AddElement('extensions',[])
]),
AddElement('extensions',[])
]
);
end;
Please help me !
I've spotted relevant post from Miha Remec on OmniXML site.
One possible answer to my question might be boiled down to as follows :
with OwnerDocument(Result.XMLNode) do
begin
InsertBefore(CreateProcessingInstruction('xml', 'version="1.0" encoding="UTF-8"'), DocumentElement)
end;
to append just after the instruction line :
Result := CreateStorage('gpx');