Hi everybody.<br>I was trying to implement a webservice that serializes RDF to JSON using Redland PHP binding.<br>But I think that&#39;s something wrong with the librdf_parser_parse_string_into_model function, and I can not figure out what it is.<br>


The script loads a RDF string into the model, and than serializes it into JSON, very simple. <br>If I use librdf_parser_parse_into_model (instead of librdf_parser_parse_string_into_model) loading the rdf from a uri, everything goes well.<br>



<br>Any suggestions would be appreciated.<br>Thank you.<br><br>Luca<br><br><span style="font-family: courier new,monospace;">$dlls = array(&quot;redland.so&quot;, &quot;php_redland.dll&quot;, &quot;redland.dylib&quot;, &quot;redland.bundle&quot;);</span><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">foreach ($dlls as $dll) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  if(file_exists($dll)) {</span><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">    dl($dll);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  }</span><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$world=librdf_php_get_world();</span><br style="font-family: courier new,monospace;">



<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$storage=librdf_new_storage($world,&#39;hashes&#39;,&#39;dummy&#39;,&quot;new=yes,hash-type=&#39;memory&#39;&quot;);</span><br style="font-family: courier new,monospace;">



<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$model=librdf_new_model($world,$storage,null);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">$parser=librdf_new_parser($world,&#39;rdfxml&#39;,null,null);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$string = &quot;&lt;?xml version=\&quot;1.0\&quot;?&gt;\</span><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">&lt;rdf:RDF xmlns:rdf=\&quot;<a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#" target="_blank">http://www.w3.org/1999/02/22-rdf-syntax-ns#</a>\&quot;\</span><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">     xmlns:dc=\&quot;<a href="http://purl.org/dc/elements/1.1/" target="_blank">http://purl.org/dc/elements/1.1/</a>\&quot;&gt;\</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">  &lt;rdf:Description rdf:about=\&quot;<a href="http://www.dajobe.org/" target="_blank">http://www.dajobe.org/</a>\&quot;&gt;\</span><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">    &lt;dc:title&gt;Dave Beckett&#39;s Home Page&lt;/dc:title&gt;\</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    &lt;dc:creator&gt;Dave Beckett&lt;/dc:creator&gt;\</span><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">    &lt;dc:description&gt;The generic home page of Dave Beckett.&lt;/dc:description&gt;\</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  &lt;/rdf:Description&gt; \</span><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">&lt;/rdf:RDF&gt;\</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&quot;;</span><br style="font-family: courier new,monospace;">



<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">if(librdf_parser_parse_string_into_model($parser,$string,librdf_new_uri($world,&#39;<a href="http://example.org/foo%27" target="_blank">http://example.org/foo&#39;</a>),$model)){</span><br style="font-family: courier new,monospace;">



<span style="font-family: courier new,monospace;">  echo &quot;&lt;br&gt;parsing error&lt;br&gt;&quot;;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;">



<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$serializer=librdf_new_serializer($world,&#39;json&#39;,null, null);</span><br style="font-family: courier new,monospace;">



<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$res = librdf_serializer_serialize_model_to_string($serializer,null,$model);</span><br style="font-family: courier new,monospace;">



<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">echo $res;</span><br>