Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the RDF-Trine CPAN distribution.

Report information
The Basics
Id: 69899
Status: patched
Priority: 0/
Queue: RDF-Trine

People
Owner: Nobody in particular
Requestors: SADI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.135
Fixed in: (no value)



Subject: escaping XML "rdf:about" attribute in RDFXML serializer
Hi Gregory, I noticed a small bug in the RDFXML serializer (RDF/Trine/Serializer/RDFXML.pm): Values of the rdf:about XML attribute are not properly escaped for the chars [&<"]. I've attached a patch which you can apply with $ patch RDF/Trine/RDFXML.pm RDFXML.pm.patch Below is a small example output file demonstrating the error. The ampersand is properly escaped in the value for "rdf:resource", but not in the value for "rdf:about". Show quoted text
--- BEGIN QUOTE --- <?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sio="http://semanticscience.org/resource/"> <rdf:Description rdf:about="http://dev.biordf.net/~benv/cgi-bin/flybase/sequence?id=4&strand=1"> <sio:SIO_000210 rdf:resource="http://dev.biordf.net/~benv/cgi-bin/flybase/strand?id=4&amp;strand=1"/> </rdf:Description> </rdf:RDF> -- END QUOTE --
Subject: RDFXML.pm.patch
*** /usr/local/share/perl/5.10.1/RDF/Trine/Serializer/RDFXML.pm 2011-04-30 16:24:44.000000000 -0700 --- lib/RDF/Trine/Serializer/RDFXML.pm 2011-07-29 16:41:22.000000000 -0700 *************** *** 162,171 **** --- 162,176 ---- if ($s->isa('RDF::Trine::Node::Blank')) { my $b = $s->blank_identifier; $id = qq[rdf:nodeID="$b"]; } else { my $i = $s->uri_value; + for ($i) { + s/&/&amp;/g; + s/</&lt;/g; + s/"/&quot;/g; + } $id = qq[rdf:about="$i"]; } my $counter = 1; my %namespaces = %{ $self->{namespaces} };
Thank you for the bug report. I've applied the patch, and it will appear in the next release of RDF::Trine. thanks, .greg