首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在Map Basic上读取GPS XML文件?

如何在Map Basic上读取GPS XML文件?
EN

Stack Overflow用户
提问于 2015-02-17 16:45:22
回答 1查看 414关注 0票数 0

我想写一个程序,在下面读取XML文件。

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8"?>
-<GPSLog cultureInfo="tr-TR" name="GPS 1_Log" version="4.0.3860">
-<PVTInfo Mode="GPSModeType3D" Status="GPSStatusTypeDOINGFIXES" TDOP="0"                                                       
VDOP="0,7" HDOP="0,7" PDOP="1,476482" Depth="0"                            
MagneticVariation="-5,19999999999999" Heading="338,9" Speed="0,05"                       
GeoidHeight="1089,9" EllipsoidHeight="1120" Longitude="35,5297421666667"
Latitude="38,7525401666667" LastTime="51969,2" Time="51969,3"                               
ValidFlags="14327" >
-<Satellites>
<SatInfo Used="True" SNR="42" Azimuth="242" Elevation="70" PRN="69"/>
<SatInfo Used="True" SNR="43" Azimuth="188" Elevation="61" PRN="28"/>
<SatInfo Used="True" SNR="47" Azimuth="282" Elevation="41" PRN="5"/>
<SatInfo Used="True" SNR="47" Azimuth="202" Elevation="35" PRN="10"/>
<SatInfo Used="True" SNR="45" Azimuth="53" Elevation="45" PRN="7"/>
<SatInfo Used="True" SNR="38" Azimuth="123" Elevation="31" PRN="9"/>
<SatInfo Used="True" SNR="35" Azimuth="172" Elevation="28" PRN="74"/>
<SatInfo Used="True" SNR="32" Azimuth="62" Elevation="13" PRN="91"/>
<SatInfo Used="True" SNR="47" Azimuth="10" Elevation="69" PRN="30"/>
<SatInfo Used="True" SNR="40" Azimuth="324" Elevation="33" PRN="78"/>  
<SatInfo Used="True" SNR="40" Azimuth="347" Elevation="63" PRN="72"/>
<SatInfo Used="True" SNR="38" Azimuth="310" Elevation="25" PRN="13"/>
<SatInfo Used="False" SNR="37" Azimuth="139" Elevation="36" PRN="39"/>
<SatInfo Used="False" SNR="38" Azimuth="264" Elevation="34" PRN="85"/>
<SatInfo Used="False" SNR="33" Azimuth="59" Elevation="15" PRN="19"/>
<SatInfo Used="False" SNR="38" Azimuth="181" Elevation="12" PRN="20"/>
<SatInfo Used="False" SNR="19" Azimuth="110" Elevation="7" PRN="84"/
</Satellites>
</PVTInfo>

我需要Lat,Long和time值,所以我想在读取文件时跳过其他东西。我将使用这些点来绘制直线对象。

提前感谢

EN

回答 1

Stack Overflow用户

发布于 2015-02-17 23:16:23

MapBasic提供了许多特定于XML的函数。您的代码可能如下所示(未经过测试):

代码语言:javascript
运行
复制
Dim xmlDoc as MIXmlDocument
Dim xmlNode As MIXmlNode
Dim res Integer
Dim pbParsingError As SmallInt
Dim lat as String

hxml = MIXmlDocumentCreate( )
res := MIXmlDocumentLoad(xmlDoc, "C:\Your_Path\Your_File.xml", pbParsingError, 0, 0)
xmlNode = MIXmlDocumentGetRootNode(xmlDoc)
xmlNode = MIXmlSelectSingleNode(xmlNode, "/GPSLog/PVTInfo")
res = MIXmlNodeGetAttributeValue(xmlNode, "Latitude", lat, 20)
Print "Latitude = " + lat

MIXmlDocumentDestroy(xmlDoc)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28557870

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档