[redland-dev] Possible issue with Python binding, XMLLiterals

Dave Beckett dave.beckett at bristol.ac.uk
Fri May 13 00:55:49 BST 2005


On Thu, 12 May 2005, Danny Ayers wrote:
> I'm tired enough to miss something obvious (no change), but am getting
> escaping where I didn't expect:
> 
> ----------source-------------------
> 
> from RDF import Uri, Model, Node, Statement
> 
> model = Model()
> 
> subject = Node(Uri("http://example.org"))
> predicate = Node(Uri("http://example.org/prop"))
> object = Node(literal="<tag>content</tag>", is_wf_xml=1)
> 
> model.append(Statement(subject,predicate,object))
> 
> print model.to_string()
> 
> -----output------------------------
> 
> <?xml version="1.0" encoding="utf-8"?>
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
>   <rdf:Description rdf:about="http://example.org">
>     <ns0:prop xmlns:ns0="http://example.org/"
> rdf:datatype="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral">&lt;tag&gt;content&lt;/tag&gt;</ns0:prop>
>   </rdf:Description>
> </rdf:RDF>
> 
> ----------------------
> (using build from CVS a couple of weeks ago)
> 
> That isn't right, is it..?

It's legal.  There's no compulsion to use rdf:parseType="Literal" for XML 
literals.

However, the serializer should do this as that's what the code says but I 
see it's not quite got all the cases covered so it produces what you see 
there.

"fixed in CVS", raptor_serialize.c CVS 1.32

Dave



More information about the redland-dev mailing list