Super_Anonymous


Hi,
I am getting a error indicating a malformed xml document.

here is what my browser says;

ML Parsing Error: not well-formed
Location: http://192.168.0.51/MAP.xml
Line Number 2, Column 19:<rss version="2.0"xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
------------------^

Here is some of the file

< xml version="1.0" encoding="utf-8" >
<rss version="2.0"xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
<channel>
<title>Reported Phish</title>
<link/>
<description>RECENT PHISH REPORTS</description>
<item>
<title>WELLS FARGO</title>
<description>SCHLUND + PARTNER AG</description>
<link><a href='http://www.mednutrition.gr/images/update-wells-info/index.html secure%25%25loginWellsfaargo2006#online%25%25bankingserviceUpdate%25%25informationswellsfragobank%25%25onlinebanking=login' target='P_25230'>http://www.mednutrition.gr/images...</a><\link>
<icon>_img/map.gfx/likely.gif</icon>
<geo:lat>50.12</geo:lat>
<geo:long>8.68</geo:long>
</item>


Also,
I am using this in a layer. I cant seem to get it to render the layer.

I am using code like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5"></script>
<script language="JavaScript">
var map = null;



function hazards()
{
var veLayerSpec = new VELayerSpecification();
veLayerSpec.Type = VELayerType.GeoRSS;
veLayerSpec.ID = 'Hazards';
veLayerSpec.LayerSource = 'http://localhost/MAP.xml';
veLayerSpec.Method = 'get';
map.AddLayer(veLayerSpec);
}

function OnPageLoad()
{
map = new VEMap('myMap');
map.LoadMap(new VELatLong(24.30, 13.00), 1,'r' ,false);
hazards();
}
</script>

<style>
</style>

<body onload="OnPageLoad();">
<div id="myMap" style="position:relative;width:800px;height:400px;"></div>
</body>
</html>


I have tried this with a well formed xml document and it still will not load pins.

Any one see what I am missing

Thanks



Re: mal formed xml and other xml issue

Derek Chan


I've noticed some issues with the data:

1) Missing ending </rss> tag
2) <Title> and </link> tag outside of an <item> block
3) Missing end </channel> tag

Here's a simple RSS file you can use to cross reference:

< xml version="1.0" >
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns="http://www.w3.org/2003/01/geo/wgs84_pos#">
<channel>
<item>
<name>Sample location</name>
<description>Aspen, CO</description>
<geo: Point>
<geo:lat>39.1930007935</geo:lat>
<geo:lon>-106.820999146</geo:lon>
</geo: Point>
<icon>pushpin-green.gif</icon>
</item>
</channel>
</rss>

Hope that helps,





Re: mal formed xml and other xml issue

Super_Anonymous

Thanks for the help with the xml doc.

I tried loading yours and still its not rendering.
I substituted my graphic for the pin...
function hazards()
{
var veLayerSpec = new VELayerSpecification();
veLayerSpec.Type = VELayerType.GeoRSS;
veLayerSpec.ID = 'Hazards';
veLayerSpec.LayerSource = 'http://localhost/new.xml';
veLayerSpec.Method = 'get';
map.AddLayer(veLayerSpec);
}

function OnPageLoad()
{
map = new VEMap('myMap');
map.LoadMap(new VELatLong(24.30, 13.00), 1,'r' ,false);
hazards();
}
As I am posting this I am wondering about permissions...





Re: mal formed xml and other xml issue

Derek Chan

That won't work if you run it through Internet Explorer locally, you need to have it hosted off a web server so that xmlHTTPRequests will work under IE. If you run it under firefox, it shouldn't have problems running a locally hosted XML file.




Re: mal formed xml and other xml issue

Super_Anonymous

I'm running it under apache with firefox. That why I was thinking something might have gotten over looked.




Re: mal formed xml and other xml issue

Jared H

Hmmm, ok from what I see there are a few issues here. Your GeoRSS syntax as posted is v4 syntax. A v5 implementation would look like the below. I'm referencing a file local to the hosting htm page; otherwise you'd need to throw in a full URL. You can check the SDK further for what null method parameters I'm passing in here...those can be populated and used as you need. Other things to consider as you test are a) the API agressively caches the xml files, so changes aren't reflected instantly as you refresh the map control; b) I have not been able to successfully set custom <icons> from within the GeoRSS file itself -- it is as though the xml parser has a glitch in it that v4 did not; and c) the parser is much stricter in requiring <title> and <description> nodes [it will throw js errors where v4 did not].

Code Snippet

function v5hazards()
{
var layer = new VEShapeSourceSpecification(VEDataType.GeoRSS,'GeoRSSTest7.xml',null)
map.ImportShapeLayerData(layer,null,true);
}


Source file:

< xml version="1.0" >
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
<channel>
<title>Sample location</title>
<description>Aspen, CO</description>
<item>
<title>Sample location</title>
<description>Aspen, CO</description>
<geo:lat>39.1930007935</geo:lat>
<geo:lon>-106.820999146</geo:lon>
<icon>pushpin-green.gif</icon>
</item>
</channel>
</rss>