C
Carl Bourne
Hi,
I would like to process an XML file using REXML and recurse down through
some sub elements, e.g. the "group" and "cond" elements in the following
XML:
<rule>
<name>Test Rule</name>
<description>This is a test rule</description>
<order>2</order>
<group operator="all">
<cond name="condition1"/>
<group operator="not">
<cond name="condition2"/>
<group operator="not">
<cond name="condition3"/>
</group>
</group>
</group>
</rule>
However, I need to produce output that maintains the hierarchy so it can
be displayed as a nested list such as:-
<h1>Rule Name - Test Rule</h1>
<h1>Rule Description - Test Rule</h1>
<ul>
<li>group operator is all - condition name is condition 1
<ul>
<li>group operator is not - condition name is condition 2
<ul>
<li>group operator is not - condition name is condition 3</li>
</ul>
</li>
</ul>
</li>
</ul>
I can't seem to find any examples of doing this, would somebody be so
kind as to provide me with an example of how I could do this?
Regards,
Carl
I would like to process an XML file using REXML and recurse down through
some sub elements, e.g. the "group" and "cond" elements in the following
XML:
<rule>
<name>Test Rule</name>
<description>This is a test rule</description>
<order>2</order>
<group operator="all">
<cond name="condition1"/>
<group operator="not">
<cond name="condition2"/>
<group operator="not">
<cond name="condition3"/>
</group>
</group>
</group>
</rule>
However, I need to produce output that maintains the hierarchy so it can
be displayed as a nested list such as:-
<h1>Rule Name - Test Rule</h1>
<h1>Rule Description - Test Rule</h1>
<ul>
<li>group operator is all - condition name is condition 1
<ul>
<li>group operator is not - condition name is condition 2
<ul>
<li>group operator is not - condition name is condition 3</li>
</ul>
</li>
</ul>
</li>
</ul>
I can't seem to find any examples of doing this, would somebody be so
kind as to provide me with an example of how I could do this?
Regards,
Carl