[OpenLayers-Users] XML Parsing via OpenLayers?
Maps-R-us
mlaudon at laudontech.com
Tue Oct 7 13:27:59 EDT 2008
Thank you Bart,
I actually do this in my loadSuccess function:
function loadSuccess(request) {
updateStatus("loaded");
if(!request.responseXML.documentElement) {
doc = format.read(request.responseText);
} else {
doc = request.responseXML;
}
}
Is this correct?
M
Bart van den Eijnden wrote:
>
> You need to parse the XML in the loadSuccess function, check
> examples/GMLParser.html for an example.
>
> Best regards,
> Bart
>
> Maps-R-us wrote:
>> Hi there,
>>
>> I would like to retrieve elements in an xml file based on tag name and
>> populate an array. Here is a sample of the XML:
>>
>> <users>
>> <user>
>> <fullname>Test</fullname>
>> <ID>3400</ID>
>> <lat>0.003926753994724706</lat>
>> <lon>0.00446319580078125</lon>
>>
>> <image>http://40.media.vimeo.com/d1/5/35/85/81/portrait-35858134.jpg</image>
>> <floor>3</floor>
>> </user>
>> </users>
>>
>> My code fails on the getElementsByNameNS()
>>
>>
>> var format = new OpenLayers.Format.XML();
>> var doc = null;
>> var url = "officedata.xml";
>> OpenLayers.loadURL(url, null, null, loadSuccess, loadFailure);
>> var attributeValue = [];
>> var attributeValue[1] = format.getElementsByTagNameNS(doc,
>> '*','fullname');
>> alert (attributeValue[1]);
>>
>> Any ideas?
>>
>> Thank you in advance,
>>
>> M
>>
>>
>
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> bartvde at osgis.nl
> http://www.osgis.nl
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://www.nabble.com/XML-Parsing-via-OpenLayers--tp19861923p19863213.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list