Created
September 11, 2013 19:36
-
-
Save nick1123/6528690 to your computer and use it in GitHub Desktop.
Strange behavior using Nokogiri xpath
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xml = '<?xml version="1.0" encoding="utf-8"?><mdx version="4.0" xmlns="responseSimple" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></mdx>' | |
| parsed = Nokogiri.parse(xml) | |
| parsed.xpath('/mdx').present? | |
| # => false | |
| xml = '<?xml version="1.0" encoding="utf-8"?><mdx></mdx>' | |
| parsed = Nokogiri.parse(xml) | |
| parsed.xpath('/mdx').present? | |
| # => true | |
| # Running jruby-1.7.2 on Ubuntu 12.04 |
quixoten
commented
Sep 11, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment