Xml, XPath+xmlns+delphi : problème
Bonjour
J'ai un problème.. le voici..
J'ai ce fichier :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
<?xml version="1.0" encoding="UTF-8"?>
<kml>
<Document>
<name>hollande.kml</name>
<LookAt>
<longitude>8.84951614383266</longitude>
<latitude>54.9296676053168</latitude>
<altitude>5000</altitude>
<rang>5000</rang>
<tilt>0</tilt>
<altitudeMode>RelativeToGround</altitudeMode>
</LookAt>
<Style id="route">
<LineStyle>
<color>D80000FF</color>
<width>4</width>
</LineStyle>
</Style>
<Placemark>
<styleUrl>#route</styleUrl>
<name>VirtualBikePath</name>
<visibility>1</visibility>
<LineString>
<tessellate>1</tessellate>
<coordinates>8.84951614383266,54.9296676053168,0.0420476804603833
8.84947705966923,54.9297642750836,0 </coordinates>
</LineString>
</Placemark>
</Document>
</kml> |
Mon code en delphi est utilisé pour obtenir le champ <coordinates>
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
function TXmlDatas.ReturnPointOnString(FileName : String {In} ): String;
var
//Node : IXMLNode;
Node : IDOMNode;
begin
//Ouvre le fichier kml
FXMLDoc.LoadFromFile(FileName);
//Valide le fichier XML
FXMLDoc.Active:=true;
//Recherche en Xpath avec Dom.
Node := (FXMLDoc.DOMDocument as IDOMNodeSelect).SelectNode('//coordinates/text()');
if Assigned(Node) then
begin
//Retourne toutes les coordonnées
ReturnPointOnString:=Node.nodeValue;
end;
FXMLDoc.Active:=False;
end; |
Cela fonction parfaitement ! Mais quand je veux changer la balise <kml> en
Code:
1 2
|
<kml xmlns="http://earth.google.com/kml/2.0"> |
Plus rien ne fonction ! Pourquoi ??