I am creating an XML file which starts like this:
XNamespace xNamespace = "http://www.topografix.com/GPX/1/1";
var trkseg = new XElement("trkseg");
XElement GPX = new XElement(xNamespace + "gpx",
new XAttribute("xmlns", xNamespace),
new XAttribute("version", "1.0"),
new XAttribute("creator", "quilkin.co.uk"),
new XElement("trk",
new XElement("name", RouteName()),
trkseg
)
);
which produces the following:
<gpx creator="quilkin.co.uk" version="1.0" xmlns="http://www.topografix.com/GPX/1/1">
<trk xmlns="">
<name>Route Name</name>
<trkseg/>
</trk>
</gpx>
I'm puzled why the 'trk' element has an attribute 'xlmns'. The addition of this isn't a problem with most readers of GPX files, but one (very common one!) does not like it and refuses to load the file.
I could manipulate the text to remove the attribute, but why is it occuring?