[xwiki-devs] Writing a Macro in XWiki 1.3
Hello, I want to include this code in a macro in a 1.3 version...but I don“t find any example of how to do this... Could you help me and tell me if there is any way to do this?? The URL will be the parameter of the macro... <% try { URL timelineURL = new URL("http://ws.geonames.org/search?name_equals=den&fcode=airp&style=full"); def connection = timelineURL.openConnection(); def xml = connection.content.text def geonames = new XmlSlurper().parseText(xml) def result = [:] result.name = geonames.geoname.name as String result.lat = geonames.geoname.lat as String result.state = geonames.geoname.adminCode1 as String result.lng = geonames.geoname.lng as String result.country = geonames.geoname.countryName as String //print ("Nombre: " + "\n") //print result.name + "\n" //print ("\n") //print ("Latitud: " + "\n") //print result.lat + "\n" //print ("\n") //print ("Longitud: " + "\n") //print result.lng + "\n" //print ("\n") //print ("Estado: " + "\n") //print result.country + "\n" print ("{" + "code}\n") print xml + "\n" print ("{" + "code}\n") print ("{" + "table}\n") print "Nombre" + "|" + "Latitud" + "|" + "Longitud" + "|" + "Estado" print ("\n") print result.name + "|" + result.lat + "|" + result.lng + "|" + result.country print ("{" + "table}\n") } catch(Exception e) {print e.message} %> Thank you. ------------------------------------------------------------------ This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted. Este mensaje y los ficheros adjuntos pueden contener informacion confidencial destinada solamente a la(s) persona(s) mencionadas anteriormente pueden estar protegidos por secreto profesional. Si usted recibe este correo electronico por error, gracias por informar inmediatamente al remitente y destruir el mensaje. Al no estar asegurada la integridad de este mensaje sobre la red, Atos Origin no se hace responsable por su contenido. Su contenido no constituye ningun compromiso para el grupo Atos Origin, salvo ratificacion escrita por ambas partes. Aunque se esfuerza al maximo por mantener su red libre de virus, el emisor no puede garantizar nada al respecto y no sera responsable de cualesquiera danos que puedan resultar de una transmision de virus. ------------------------------------------------------------------
participants (1)
-
Roberto Perez Santamaria