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...
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...
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
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"...
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 : " +...
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"...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.