caseyhoward / nokogiri-plist

A PList parser and generator built using Nokogiri
MIT License
25 stars 15 forks source link

Invalid XML output if string contains "&". #7

Open fuuka opened 13 years ago

fuuka commented 13 years ago

If string contains "&", it not escape to "&". So output XML is invalid.

ruby-1.9.2-p290 :001 > "a&b".to_plist_xml
 => "<string>a&b</string>" 

from "bundle list":

* nokogiri (1.5.0)
* nokogiri-plist (0.5.0)
caseyhoward commented 12 years ago

I was looking into your bug, when I realized that I'm an idiot for not using Nokogiri to build the XML. Nokogiri handles special characters and other cases. I was just using Nokogiri to parse. Anyway, I'm working on a new branch with this change. It makes the code a lot more simple. It's working for all I know. I just need to test it more and update the documentation. Here's the branch: https://github.com/caseyhoward/nokogiri-plist/tree/nokogiri_xml_builder if you want to check it out. I could have made a quick fix using CGI::escape, but I think this is a lot better.