ruby - Nokogiri: Handling text nodes -
Is there another great way to get the contents of text nodes with the nungee? Right now I am using something like this:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Testcase & gt; & Lt; ID & gt; 53 & lt; / Id & gt; & Lt; Code & gt; WKDO-188,465 & lt; / Code & gt; & Lt; / testcase & gt; Xml = Nokogiri :: XML (File.open ('test.xml')) ID = xml.at_css ('TestCase ID'). Children.first.textcode = xml.at_css ('TestCase code'). Children.first .text
In this case you use the text-less on the elements directly We do.
xml = Nokogiri :: XML (file.open ('test.xml')) ID = xml.at_css ('TestCase ID'). Text code = xml.at_css ('TestCase Code') .text
Comments
Post a Comment