问题
I'm trying to consume some legacy XML with elements like this in JRuby:
<x-doc attr="value">
<nested>
<with.dot>content</with.dot >
</nested>
</x-doc>
I've been working with Hpricot, but Hpricot's HTML-oriented shortcuts are working against me: doc.search("//with.dot")
seems to be looking for <with class="dot" />
(I ran into this problem with JQuery too, a few years ago.)
Can I do this with Hpricot, or do I need to use a different library?
回答1:
Check out nokogiri. It's said to be "A Faster, Better HTML and XML Parser for Ruby (than Hpricot)".
来源:https://stackoverflow.com/questions/1396511/parse-xml-with-jruby-hpricot-with-tags-like-foo-bar