ruby-rdf / rdf-rdfxml

Ruby RDF/XML reader/writer for RDF.rb.
http://rubygems.org/gems/rdf-rdfxml
The Unlicense
17 stars 7 forks source link

correct XML escaping of illegal characters in literals #34

Closed barmintor closed 9 years ago

barmintor commented 9 years ago

Ampersands in XML content need to be escaped, and in attributes where appropriate.

gkellogg commented 9 years ago

Thanks, but note that there seems to be a problem with the pure- version running REXML.

barmintor commented 9 years ago

In transit, will follow up ASAP On Feb 24, 2015 6:50 PM, "Gregg Kellogg" notifications@github.com wrote:

Thanks, but note that there seems to be a problem with the pure- version running REXML.

— Reply to this email directly or view it on GitHub https://github.com/ruby-rdf/rdf-rdfxml/pull/34#issuecomment-75876849.

barmintor commented 9 years ago

Do REXML and NG have different deserializations for attributes? That's awkward.

On Tue, Feb 24, 2015 at 6:58 PM, Benjamin Armintor armintor@gmail.com wrote:

In transit, will follow up ASAP On Feb 24, 2015 6:50 PM, "Gregg Kellogg" notifications@github.com wrote:

Thanks, but note that there seems to be a problem with the pure- version running REXML.

— Reply to this email directly or view it on GitHub https://github.com/ruby-rdf/rdf-rdfxml/pull/34#issuecomment-75876849.

gkellogg commented 9 years ago

You probably hit an untested corner case. The reader uses an abstraction layer for the different libraries. I can try to look at it tomorrow, if you like.

barmintor commented 9 years ago

It would be great if you had a chance, will check in again tomorrow to see what I can do. We'll work from a branch in the meantime (the attribute case doesn't apply to us)

gkellogg commented 9 years ago

It seems that REXML XPath varies slightly for returning the attribute content. Nokogiri unescapes the result, REXML doesn't.

I separated the tests into with- and without-attribute use; fixed a bug where the triple was being output both as an attribute and an element, and restored the original simple example it was based on.

Thanks for finding and working on this!

barmintor commented 9 years ago

Thanks for the library!

On Wed, Feb 25, 2015 at 2:13 AM, Gregg Kellogg notifications@github.com wrote:

It seems that REXML XPath varies slightly for returning the attribute content. Nokogiri unescapes the result, REXML doesn't.

I separated the tests into with- and without-attribute use; fixed a bug where the triple was being output both as an attribute and an element, and restored the original simple example it was based on.

Thanks for finding and working on this!

— Reply to this email directly or view it on GitHub https://github.com/ruby-rdf/rdf-rdfxml/pull/34#issuecomment-75915915.