{"id":1131,"date":"2010-09-07T11:28:24","date_gmt":"2010-09-07T09:28:24","guid":{"rendered":"http:\/\/lloc.de\/?p=1131"},"modified":"2025-09-12T14:24:20","modified_gmt":"2025-09-12T12:24:20","slug":"xml-json-e-rdf","status":"publish","type":"post","link":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/","title":{"rendered":"XML, JSON e RDF"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Grazie alle funzioni native, l&#8217;elaborazione di <strong>XML<\/strong> (eXtensible Markup Language) e&nbsp;<strong>JSON<\/strong> (JavaScript Object Notation) non costituisce pi\u00f9 un problema. Anche se JSON in fondo \u00e8 pensato per applicazioni Ajax , preferisco il formato anche in PHP quando voglio e posso evitare l&#8217;overhead dei dati XML.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">Il&nbsp;<a href=\"http:\/\/www.geonames.org\/export\/ws-overview.html\">Geonames-Webservices<\/a> \u00e8 un buon punto di partenza per qualche esempio perch\u00e9 presenta le funzioni del servizio che sono in grado di fornire i dati in almeno questi due formati. In pi\u00f9 le funzioni di Geonames sono probabilmente molto interessanti per tanti Webmaster. Chi \u00e8 interessato a richieste diverse dovrebbe consultare la documentazione del Webservice.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Per una richiesta generica con la query&nbsp;london&nbsp;basta l&#8217;URL seguente:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>http:\/\/ws.geonames.org\/search?q=london&amp;maxRows=10<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Il parametro maxRows&nbsp;controlla il numero dei risultati. Per definizione il risultato viene fornito in XML.&nbsp;Se si vuole il formato JSON si deve aggiungere il parametro&nbsp;type:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>http:\/\/ws.geonames.org\/search?q=london&amp;maxRows=10&amp;type=json<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dando un&#8217;occhiata pi\u00f9 specifica alla lista dei Geonames-Services si scopre che si pu\u00f2 richiedere anche il formato <strong>RDF<\/strong> (Resource Description Framework). Chiunque voglia entrare nel mondo del Semantic Web dovrebbe dedicarsi a prendere confidenza con questo formato. Se non avete ancora idea di che cosa si tratti, un buon punto di partenza \u00e8 il sito del <a href=\"https:\/\/www.w3.org\/standards\/semanticweb\/\">W3C<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Le funzioni ovvero i metodi SimpleXML di PHP falliscono con RDF. Anche se il formato viene chiamato RDF\/XML la classe SimpleXML presenta problemi con i due punti negli XML-Entities. Le soluzioni per\u00f2 ci sono. Personalmente preferisco&nbsp;Arc. Il pacchetto va semplicemente caricato e messo a disposizione sul server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Come elaborare con PHP tutti e tre i formati descritti, \u00e8 illustrato dal code seguente:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/gist.github.com\/4525307\">https:\/\/gist.github.com\/4525307<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Grazie alle funzioni native, l&#8217;elaborazione di XML (eXtensible Markup Language) e&nbsp;JSON (JavaScript Object Notation) non costituisce pi\u00f9 un problema. Anche se JSON in fondo \u00e8 pensato per applicazioni Ajax , preferisco il formato anche in PHP quando voglio e posso evitare l&#8217;overhead dei dati XML.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[2],"tags":[13,22,34],"class_list":["post-1131","post","type-post","status-publish","format-aside","hentry","category-code","tag-json","tag-rdf","tag-xml","post_format-post-format-aside"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>XML, JSON e RDF - realloc&#039;s asylum<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"XML, JSON e RDF - realloc&#039;s asylum\" \/>\n<meta property=\"og:description\" content=\"Grazie alle funzioni native, l&#8217;elaborazione di XML (eXtensible Markup Language) e&nbsp;JSON (JavaScript Object Notation) non costituisce pi\u00f9 un problema. Anche se JSON in fondo \u00e8 pensato per applicazioni Ajax , preferisco il formato anche in PHP quando voglio e posso evitare l&#8217;overhead dei dati XML.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/\" \/>\n<meta property=\"og:site_name\" content=\"realloc&#039;s asylum\" \/>\n<meta property=\"article:published_time\" content=\"2010-09-07T09:28:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-12T12:24:20+00:00\" \/>\n<meta name=\"author\" content=\"realloc\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Scritto da\" \/>\n\t<meta name=\"twitter:data1\" content=\"realloc\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tempo di lettura stimato\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/xml-json-e-rdf\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/xml-json-e-rdf\\\/\"},\"author\":{\"name\":\"realloc\",\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/#\\\/schema\\\/person\\\/571f8ada841cca782e8001b942e032c8\"},\"headline\":\"XML, JSON e RDF\",\"datePublished\":\"2010-09-07T09:28:24+00:00\",\"dateModified\":\"2025-09-12T12:24:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/xml-json-e-rdf\\\/\"},\"wordCount\":299,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/#\\\/schema\\\/person\\\/571f8ada841cca782e8001b942e032c8\"},\"keywords\":[\"JSON\",\"RDF\",\"xml\"],\"articleSection\":[\"Codice\"],\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ploetner.io\\\/it\\\/xml-json-e-rdf\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/xml-json-e-rdf\\\/\",\"url\":\"https:\\\/\\\/ploetner.io\\\/it\\\/xml-json-e-rdf\\\/\",\"name\":\"XML, JSON e RDF - realloc&#039;s asylum\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/#website\"},\"datePublished\":\"2010-09-07T09:28:24+00:00\",\"dateModified\":\"2025-09-12T12:24:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/xml-json-e-rdf\\\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ploetner.io\\\/it\\\/xml-json-e-rdf\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/xml-json-e-rdf\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ploetner.io\\\/it\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"XML, JSON e RDF\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/#website\",\"url\":\"https:\\\/\\\/ploetner.io\\\/it\\\/\",\"name\":\"realloc's asylum\",\"description\":\"Software Developer &amp; WordPress Enthusiast | Born in Germany. Reborn in Italy.\",\"publisher\":{\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/#\\\/schema\\\/person\\\/571f8ada841cca782e8001b942e032c8\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ploetner.io\\\/it\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/#\\\/schema\\\/person\\\/571f8ada841cca782e8001b942e032c8\",\"name\":\"realloc\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/wp-content\\\/uploads\\\/sites\\\/7\\\/sites\\\/9\\\/2022\\\/11\\\/52602486_10215993351498483_6040822616506236928_n.jpg\",\"url\":\"https:\\\/\\\/ploetner.io\\\/it\\\/wp-content\\\/uploads\\\/sites\\\/7\\\/sites\\\/9\\\/2022\\\/11\\\/52602486_10215993351498483_6040822616506236928_n.jpg\",\"contentUrl\":\"https:\\\/\\\/ploetner.io\\\/it\\\/wp-content\\\/uploads\\\/sites\\\/7\\\/sites\\\/9\\\/2022\\\/11\\\/52602486_10215993351498483_6040822616506236928_n.jpg\",\"width\":847,\"height\":848,\"caption\":\"realloc\"},\"logo\":{\"@id\":\"https:\\\/\\\/ploetner.io\\\/it\\\/wp-content\\\/uploads\\\/sites\\\/7\\\/sites\\\/9\\\/2022\\\/11\\\/52602486_10215993351498483_6040822616506236928_n.jpg\"},\"description\":\"Software Developer &amp; WordPress Enthusiast | Born in Germany. Reborn in Italy.\",\"sameAs\":[\"https:\\\/\\\/ploetner.io\\\/\"],\"url\":\"https:\\\/\\\/ploetner.io\\\/it\\\/author\\\/realloc\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"XML, JSON e RDF - realloc&#039;s asylum","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/","og_locale":"it_IT","og_type":"article","og_title":"XML, JSON e RDF - realloc&#039;s asylum","og_description":"Grazie alle funzioni native, l&#8217;elaborazione di XML (eXtensible Markup Language) e&nbsp;JSON (JavaScript Object Notation) non costituisce pi\u00f9 un problema. Anche se JSON in fondo \u00e8 pensato per applicazioni Ajax , preferisco il formato anche in PHP quando voglio e posso evitare l&#8217;overhead dei dati XML.","og_url":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/","og_site_name":"realloc&#039;s asylum","article_published_time":"2010-09-07T09:28:24+00:00","article_modified_time":"2025-09-12T12:24:20+00:00","author":"realloc","twitter_card":"summary_large_image","twitter_misc":{"Scritto da":"realloc","Tempo di lettura stimato":"2 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/#article","isPartOf":{"@id":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/"},"author":{"name":"realloc","@id":"https:\/\/ploetner.io\/it\/#\/schema\/person\/571f8ada841cca782e8001b942e032c8"},"headline":"XML, JSON e RDF","datePublished":"2010-09-07T09:28:24+00:00","dateModified":"2025-09-12T12:24:20+00:00","mainEntityOfPage":{"@id":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/"},"wordCount":299,"commentCount":2,"publisher":{"@id":"https:\/\/ploetner.io\/it\/#\/schema\/person\/571f8ada841cca782e8001b942e032c8"},"keywords":["JSON","RDF","xml"],"articleSection":["Codice"],"inLanguage":"it-IT","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ploetner.io\/it\/xml-json-e-rdf\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/","url":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/","name":"XML, JSON e RDF - realloc&#039;s asylum","isPartOf":{"@id":"https:\/\/ploetner.io\/it\/#website"},"datePublished":"2010-09-07T09:28:24+00:00","dateModified":"2025-09-12T12:24:20+00:00","breadcrumb":{"@id":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ploetner.io\/it\/xml-json-e-rdf\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ploetner.io\/it\/xml-json-e-rdf\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ploetner.io\/it\/"},{"@type":"ListItem","position":2,"name":"XML, JSON e RDF"}]},{"@type":"WebSite","@id":"https:\/\/ploetner.io\/it\/#website","url":"https:\/\/ploetner.io\/it\/","name":"realloc's asylum","description":"Software Developer &amp; WordPress Enthusiast | Born in Germany. Reborn in Italy.","publisher":{"@id":"https:\/\/ploetner.io\/it\/#\/schema\/person\/571f8ada841cca782e8001b942e032c8"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ploetner.io\/it\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":["Person","Organization"],"@id":"https:\/\/ploetner.io\/it\/#\/schema\/person\/571f8ada841cca782e8001b942e032c8","name":"realloc","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/ploetner.io\/it\/wp-content\/uploads\/sites\/7\/sites\/9\/2022\/11\/52602486_10215993351498483_6040822616506236928_n.jpg","url":"https:\/\/ploetner.io\/it\/wp-content\/uploads\/sites\/7\/sites\/9\/2022\/11\/52602486_10215993351498483_6040822616506236928_n.jpg","contentUrl":"https:\/\/ploetner.io\/it\/wp-content\/uploads\/sites\/7\/sites\/9\/2022\/11\/52602486_10215993351498483_6040822616506236928_n.jpg","width":847,"height":848,"caption":"realloc"},"logo":{"@id":"https:\/\/ploetner.io\/it\/wp-content\/uploads\/sites\/7\/sites\/9\/2022\/11\/52602486_10215993351498483_6040822616506236928_n.jpg"},"description":"Software Developer &amp; WordPress Enthusiast | Born in Germany. Reborn in Italy.","sameAs":["https:\/\/ploetner.io\/"],"url":"https:\/\/ploetner.io\/it\/author\/realloc\/"}]}},"_links":{"self":[{"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/posts\/1131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/comments?post=1131"}],"version-history":[{"count":6,"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/posts\/1131\/revisions"}],"predecessor-version":[{"id":1603,"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/posts\/1131\/revisions\/1603"}],"wp:attachment":[{"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/media?parent=1131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/categories?post=1131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ploetner.io\/it\/wp-json\/wp\/v2\/tags?post=1131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}