Updated Nokogiri migration guide for CSS support

This commit is contained in:
Yorick Peterse 2015-11-17 16:32:46 +01:00
parent 9bb908f8b1
commit 082af145e3
1 changed files with 7 additions and 2 deletions

View File

@ -44,13 +44,18 @@ CSS selectors. In Nokogiri one queries a document as following:
document.xpath('root/foo') document.xpath('root/foo')
document.css('root foo') document.css('root foo')
Oga currently only supports XPath expressions, CSS selectors will be added in Querying documents works similar to Nokogiri:
the near future. Querying documents works similar to Nokogiri:
document = Oga.parse_xml('<root><foo>bar</foo></root>') document = Oga.parse_xml('<root><foo>bar</foo></root>')
document.xpath('root/foo') document.xpath('root/foo')
or using CSS:
document = Oga.parse_xml('<root><foo>bar</foo></root>')
document.css('root foo')
Nokogiri also allows you to query a document and return the first match, opposed Nokogiri also allows you to query a document and return the first match, opposed
to an entire node set, using the method `at`. In Nokogiri this method can be to an entire node set, using the method `at`. In Nokogiri this method can be
used for both XPath expression and CSS selectors. Oga has no such method, used for both XPath expression and CSS selectors. Oga has no such method,