MapTopobaseMeta.parseFromXml

Syntax

PP.MapTopobaseMeta.parseFromXml(node: String | HTMLElement);

Parameters

node. The DOM item or string to be analyzed.

Description

The parseFromXml method analyzes data of a specified DOM item or a string.

Comments

The is a static method that returns a PP.MapTopobaseMeta object.

Example

To execute the example the page must contain the MapChart component named map (see Map Layout on HTML Page). Analyze the specified string that has XML contents, determine latitude and longitude of the map, and define value of the RU-KYA item for the OriginOffset attribute:

var metaInfo = "<metainfo><geo>" +
    "<geoItem longitude=\"37.617778\" latitude=\"55.751667\" x=\"0\" y=\"0\" /></geo>" +
    "<attributes><attribute name=\"OriginOffset\" type=\"point\">" +
    "<data id=\"RU-KYA\" value=\"0.75,0.5\" /></attribute></attributes>" +
    "</metainfo>";
// Run analysis of XML document data
var meta = PP.MapTopobaseMeta.parseFromXml(metaInfo);
// Get map geographic coordinates
var geo = meta.getGeo()[0];
console.log("Latitude: " + geo.getLatitude() + ", longitude: " + geo.getLongitude());
// Determine value of the RU-KYA item that belongs to the OriginOffset attribute
var value = meta.getAttributeDataValue("OriginOffset", "RU-KYA");
console.log("RU-KYA element value for the OriginOffset attribute: " + value);

After executing the example the browser console displays geographic latitude and longitude of the map, and the RU-KYA item value for the OriginOffset attribute:

Latitude: 55.751667, longitude: 37.617778

RU-KYA item value for the OriginOffset attribute: 0.75,0.5

See also:

MapTopobaseMeta