Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. fairyliquid

    Find and replace xml from xmldoc to another using Nokogiri

    I have 2 xml files. I want to see if xmldoc1 has the same named elements in xmldoc2. If it does, replace xmldoc2's element value with xmldoc1's. xmldoc1 looks like this: <appSettings> <add key="TestAssetIngestXsl" value="D:\Program Files\SomePlace\AdvertAssetIngestSuccessful.xsl" /> <add...
  2. fairyliquid

    Read XML file with Nokogiri

    Yeeehhaaaaaa!!! Thank you for your speedy replies. This is definitely the fix. I'll now about the namespace thing in future. Simple but clever! :)
  3. fairyliquid

    Read XML file with Nokogiri

    My issue is not resolved :( I omitted to say I have a namespace which has been generated by BizTalk. The sample xml file did not show this as I didn't think it would be an issue. If the namespace is removed from the file parsing works correctly. So my next question is how do you remove the...
  4. fairyliquid

    Read XML file with Nokogiri

    It's ok I sorted it out. Just placed the do and end in the right place. So now it's full steam ahead. Thanks again! :) xmldoc.xpath('//resourcespec/resources/resource').each do |node| puts " - #{ node['type'] } ( #{ node['name'] } )" end
  5. fairyliquid

    Read XML file with Nokogiri

    Thanks for your quick response! The XML sample I gave does work with your code, however I missed out a node. The xml to parse should look like this: <?xml version="1.0" encoding="utf-16"?> <resourcespec applicationName="Testapp" author="Joe Bloggs"> <resources> <resource type="assembly"...
  6. fairyliquid

    Read XML file with Nokogiri

    As promised here is the code I wrote so far; filename = Test.xml' file_content = File.read(filename) xmldoc = Nokogiri::XML(file_content) puts "Root attribute : " + xmldoc.root.attributes["applicationName"] puts "Type : " +...
  7. fairyliquid

    Read XML file with Nokogiri

    Hi This has been bugging me all day... I'm a Ruby newbie and I need some help.. I'm trying to read an XML file to retrieve 2 values. Below is an example of the xml. <?xml version="1.0" encoding="utf-16"?> <resources applicationName="Testapp" author="Joe Bloggs"> <resource type="assembly"...

Part and Inventory Search

Back
Top