fairyliquid
Programmer
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" name="reader.dll" version="1.0.0.1"/>
<resource type="sql" name="script.sql" version="1.0.0.0"/>
<resource type="file" name="text.txt" version="2.0.0.3"/>
<resource type="assembly" name="writer.dll" version="1.12.0.765"/>
</resources>
I want to retrieve the "name" and "version" for each "resource" that is of type="assembly" using Nokogiri.
I need to use Nokogiri as it is able to read UTF16 files and can handle & etc...
Can someone help me please? I don't have the code to hand that I wrote today, but can update this request tomorrow with my attempts so far.
I find the XML thing hard.
My Ruby version is 1.9.1 P429
Thanks in advance.
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" name="reader.dll" version="1.0.0.1"/>
<resource type="sql" name="script.sql" version="1.0.0.0"/>
<resource type="file" name="text.txt" version="2.0.0.3"/>
<resource type="assembly" name="writer.dll" version="1.12.0.765"/>
</resources>
I want to retrieve the "name" and "version" for each "resource" that is of type="assembly" using Nokogiri.
I need to use Nokogiri as it is able to read UTF16 files and can handle & etc...
Can someone help me please? I don't have the code to hand that I wrote today, but can update this request tomorrow with my attempts so far.
I find the XML thing hard.
My Ruby version is 1.9.1 P429
Thanks in advance.