Hi,

I'm having difficulty writing my XML-based digester rules to parse a simple XML
file:

<main xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
               xsi:noNamespaceSchemaLocation="myschema.xsd">

    <scenario classname="ScenarioClass">
        <child classname="ScenarioChildClass">
            <handler classname="SomeotherClass"/>
        </child>
        <child classname="AnotherScenarioChildClass"/>
        <child classname="YetAnotherScenarioChildClass"/>
    </scenario>

</main>

My digester XML rules are:

<object-create-rule pattern="parent" classname="java.util.ArrayList" />
<pattern value="main/scenario">
    <object-create-rule classname="Scenario"/>
    <set-properties-rule/>
    <pattern value="main/scenario/child">
        <object-create-rule classname="ChildMetaData"/>
        <set-properties-rule/>
            <pattern value="main/scenario/child/handler">
                <call-method-rule methodname="setHandler" paramcount="1"/>
                <call-param-rule paramnumber='0' attrname='classname'/>

            </pattern>

        <set-next-rule methodname="setChildMetaData"/>
    </pattern>
    <set-next-rule methodname="add" />
</pattern>

Essentially, what I'm striving for is when the main/scenario tag is encountered,
create an instance of a Scenario class.  This occurs as it should.

However, when it encounters main/scenario/child I would like it to create an
object of type ChildMetaData and associate the attribute of
main/scenario/child/handler specified by classname by calling the setHandler
method of ChildMetaData, then adding ChildMetaData to Scenario by calling
setChildMetaData.  Then the Scenario object gets added as an element of an
ArrayList.

I'm new to digester and have looked through the archives and the samples in the
source distro but am puzzled as to what I might be missing.

Any help is appreciated.

Thanks,
John

The information transmitted (including attachments) is covered by the 
Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is intended only 
for the person(s) or entity/entities to which it is addressed and may contain 
confidential and/or privileged material.  Any review, retransmission, 
dissemination or other use of, or taking of any action in reliance upon, this 
information by persons or entities other than the intended recipient(s) is 
prohibited.  If you received this in error, please contact the sender and 
delete the material from any computer.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to