I found that Nokogiri is pretty good at working with xml, but I met a special case
I am trying to search in node in an XML file, for example
<?xml version="1.0" encoding="utf-8" ?> <ConfigurationSection> <Configuration xmlns="clr-namespace:Newproject.Framework.Server.Store.Configuration;assembly=Newproject.Framework.Server" > <Configuration.Store>SqlServer</Configuration.Store> <Configuration.Engine>Staging</Configuration.Engine> </Configuration> </ConfigurationSection>
When i do
xml = File.new(webconfig,"r") doc = Nokogiri::XML(xml.read) nodes = doc.search("//Configuration.Store") xml.close
I have empty nodes. Is something missing? I tried
nodes = doc.search("//Configuration\.Store")
still no luck.
Updated: I linked the whole XML file
Updated xml Again: My mistake, it has namaspace
source share