<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Poul, try this:<br><br>var describeFeatureTypeRequest = OpenLayers.Request.GET({<br> url: 'http://localhost:8080/geoserver2_0_1/wfs?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=topp:bazadanych'<br> callback: parseFeatureTypes<br>});<br><br>var parseFeatureTypes = function(response) {<br> var featureTypesParser = new OpenLayers.Format.WFSDescribeFeatureType();<br> var responseText = featureTypesParser.read(response.responseText);<br> var featureTypes = responseText.featureTypes;<br> <br> for(var i=0; i<featureTypes[0].properties.length; ++i) { <br>
alert('attribute is named ' + featureTypes[0].properties[i].name);<br> alert('attribute is of type ' + featureTypes[0].properties[i].type);<br> }<br>};<br><br>Best regards,<br><br>Gabriel Nolasco<br><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div class="plainMail">------------------------------<br><br>Message: 4<br>Date: Wed, 24 Mar 2010 06:10:21 -0800 (PST)<br>From: paweluz <<a ymailto="mailto:paweluz@o2.pl" href="/mc/compose?to=paweluz@o2.pl">paweluz@o2.pl</a>><br>Subject: [OpenLayers-Users] WFSDescribeFeatureType - how to use it???<br>To: <a ymailto="mailto:users@openlayers.org" href="/mc/compose?to=users@openlayers.org">users@openlayers.org</a><br>Message-ID: <<a ymailto="mailto:1269439821755-4791176.post@n2.nabble.com"
href="/mc/compose?to=1269439821755-4791176.post@n2.nabble.com">1269439821755-4791176.post@n2.nabble.com</a>><br>Content-Type: text/plain; charset=us-ascii<br><br><br>Hi!<br><br>I was jus wandering if anyone please tell me how to use<br>WFSDescribeFeatureType class. I am thinking about getting the name of the<br>attributes from my database. I found a lot of examples like this:<br><br> var text = <br> ' .........<br><br> ' <extension base="gml:AbstractFeatureType">' +<br> ' <sequence>' +<br> ' <element name="geometry"<br>type="gml:MultiLineStringPropertyType" minOccurs="0" maxOccurs="1"/>' +<br> '
<element name="SHAPE" type="string"/>' +<br> ' <element name="SE_ANNO_CAD_DATA" type="string"/>' +<br> '<br><br> var parser = new OpenLayers.Format.WFSDescribeFeatureType();<br> var res = parser.read(text);<br><br>Ok, this works just great, if describefeature is written in string... <br>I want to get the name of my attributes from DescribeFeatureType via URL.<br>This is my url:<br><br><a href="http://localhost:8080/geoserver2_0_1/wfs/DescribeFeatureType?version=1.1.0&typename=topp:bazadanych" target="_blank">http://localhost:8080/geoserver2_0_1/wfs/DescribeFeatureType?version=1.1.0&typename=topp:bazadanych</a><br><br>If I do something like this:<br>var res =<br>parser.read("<a href="http://localhost:8080/geoserver2_0_1/wfs/DescribeFeatureType?version=1.1.0&typename=topp:bazadanych"
target="_blank">http://localhost:8080/geoserver2_0_1/wfs/DescribeFeatureType?version=1.1.0&typename=topp:bazadanych</a>");<br>of course it will not work....<br>What is the way to read XML via URL and add it to the WFSDescribeFeatureType<br>class?? <br>Can anyone please help me??<br><br>Regards,<br>Poul<br></div></blockquote></td></tr></table><br>
<hr size=1>Veja quais são os assuntos do momento no Yahoo! + Buscados: <a href="http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/">Top 10</a> - <a href="http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/celebridades/">Celebridades</a> - <a href="http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/m%C3%BAsica/">Música</a> - <a href="http://br.rd.yahoo.com/mail/taglines/mail/*http://br.maisbuscados.yahoo.com/esportes/">Esportes</a>