[英]xPath for javascript
I have this javascript code in html 我在html中有这个javascript代码
<script type="text/javascript">function initialize() {
var latlng = new google.maps.LatLng(50.475816506586240, 30.496437549591064);
var myOptions = {zoom: 16, center: latlng, draggable: false, mapTypeId: google.maps.MapTypeId.ROADMAP,scrollwheel: false};
var map = new google.maps.Map(document.getElementById("googlePlaceMap"), myOptions);
var marker = new google.maps.Marker({position: latlng, title: "Сквер"});
marker.setMap(map);
}
google.maps.event.addDomListener(window, "load", initialize);
</script>
I am trying to parse it to get latitude and longitude (lat = 50.475..., lng = 30.496...) using xPath but I can't. 我正在尝试使用xPath解析它以获取经度和纬度(经度= 50.475 ...,经度= 30.496 ...),但我做不到。 Could you help me? 你可以帮帮我吗?
You can use a combination of substring-before
and substring-after
functions: 您可以结合使用substring-before
和substring-after
函数:
substring-before(substring-after(//script/text(), "google.maps.LatLng("), ");")
This would give you the following output: 这将为您提供以下输出:
50.475816506586240, 30.496437549591064
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.