thanks for all of the excellent responses. I am going through them all.
I have attached a copy of an XML (with some of the name/value pairs
deleted for brevity.
<?xml version="1.0" encoding="UTF-8"?>
<product-state xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn://mycompany.com/ia/product-state" xsi:type="product-state">
<properties>
<!-- WebSphere properties -->
<property>
<name>core.was.home</name>
<value>/usr/IBM/WebSphere/AppServer1/profiles/AppSrvQA</value>
</property>
<property>
<name>core.was.username</name>
<value>admin</value>
</property>
<property>
<name>core.was.password</name>
<value>password</value>
</property>
<property>
<name>core.application.name</name>
<value>myapp</value>
</property>
<property>
<name>core.application.context.root</name>
<value>myroot</value>
</property>
</properties>
</product-state>
Essentially, I have hundreds of XML files like this one that contain
many many name value pairs. I am concerned that the value is defined
differently (actually I have seen this) in one or more of the XML. I
want to take an xml file and then parse the name/value pairs into a
list. Then I want to check that list against all of the other XML in the
system that have the same name/value pairs.
So I might find that one XML defines
<name>core.application.context.root</name>
<value>myroot</value>
and another XML defines this name/value pair as
<name>core.application.context.root</name>
<value>bigroot</value>
Which would indicate a configuration management error that needs to be
corrected.
(Half the application is looking in the wrong place for the
core.application.context.root)
Ultimately, I want to implement this as part of an application
deployment framework possibly using Puppet or Chef.
Bob Aiello
http://www.linkedin.com/in/BobAiello
test.xml (907 Bytes)
···
_______________________________________________________________
On 9/4/2011 3:12 PM, Bartosz Dziewoński wrote:
First of all, I'd recommend you a different library. Personalyl I
found REXML awkward to use, Nokogiri (`gem install nokogiri`) is much
better. (It also parses HTML.)We'll probably need the XML file to be able to help you.
-- Matma Rex