Get the values of attributes with namespace, using Nokogiri
问题 I'm parsing a document.xml file using Nokogiri, extracted from .docx file and need to get values of attributes with names, like " w:val ". This is a sample of the source XML: <w:document> <w:body> <w:p w:rsidR="004D5F21" w:rsidRPr="00820E0B" w:rsidRDefault="00301D39" pcut:cut="true"> <w:pPr> <w:jc w:val="center"/> </w:pPr> </w:body> </w:document> This is a sample of the code: require 'nokogiri' doc = Nokogiri::XML(File.open(path)) doc.search('//w:jc').each do |n| puts n['//w:val'] end There