dataXML method |
In our previous example, we had used the dataURL method to provide data to FusionMaps. In dataURL method, the data is contained in an external physical XML document (like Data.xml) or relayed by a URL (like ReturnXMLData.asp). There also exists another method to provide the XML data to FusionMaps - dataXML method. In this method, the XML Data exists in the same HTML page in which FusionMaps is embedded. When working with this method, you don't need to create the external XML document (like Data.xml). Instead you provide it in the HTML page. Let's quickly see an example of the above. |
Using dataXML method |
Create a copy of our previous FirstMap.html and name it as DataXMLMap.html with the following code: |
<html> <body>
|
You can clearly see above, that instead of using setDataURL method to provide the path of XML file, here we've used setDataXML method to provide the full XML data itself. When you now view the map, you'll get the same output as before. |
With this method, however, there can sometimes be problems when you're working with larger chunks of data. This problem happens due to the limitation on dataXML string length imposed by the browser. When you specify a larger chunk of data using dataXML method, the browser ignores everything after a certain length. This causes FusionMaps to hang (nothing would be displayed on-screen) as the full data has not been supplied to it. Therefore, dataURL method is recommended for larger chunks of data. |