DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34613>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34613





------- Additional Comments From [EMAIL PROTECTED]  2005-06-01 08:33 -------
Created an attachment (id=15240)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=15240&action=view)
adds simple attribute matching

I changed the following classes in the commons-digestor 1.6 to allow for simple
attribute matching.

Modified  
RuleBase.add()
Digestor.startElement()

Added
Rule.attributeXpath 
Rule.getAttributeXpath()
Rule.setAttributeXpath()
Digestor.filterRulesByValidAttributeMatch()
Digestor.useAttributeRule()
Digestor.rebuildNode()

For the following exmple.

<people>
        <person>
                <location type="home">
                        <postcode>3190<postcode>                
                </id>
        </person>
</people>

<digester-rules>
        <pattern value="people/person">
                <object-create-rule classname="com.Person" />
                <pattern value="[EMAIL PROTECTED]'home']">      
                        <call-method-rule pattern="postcode"
methodname="setPostcode" paramcount="0"/>
                </pattern>              
                <set-next-rule methodname="add" paramtype="java.lang.Object" />

        </pattern>
</digester-rules>


The person.postcode value will be 3190 as the xpath e.g.
people/person/[EMAIL PROTECTED]'home'] /postcode matches the rules.

If the sample input was then person.postcode value would not be set.


<people>
        <person>
                <location type="work">
                        <postcode>3190<postcode>                
                </id>
        </person>
</people>


The modification to code is limited to defining 1 [EMAIL PROTECTED] per xpath. 
This can
easily be changed. Also i do not pop all the of the attributes off the stack,
only the ones i need. Is there a better way to do this?


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to