commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Tarkenton <d...@tarksoft.com>
Subject Need to create custom Rule?
Date Wed, 08 Jun 2005 19:53:32 GMT
Hello all.  I have a brief question that I believe revolves around the 
creation of a custom Rule implementation.  I have an xml pattern that I 
need to digest/parse, but I'm unsure of how to go about this 
programmatically.

The pattern i'm interested in is:

<parent>
    <child name="a" value="b" />
    <child name="theParamDesired" value="theValueISeek" />
</parent>

I essentially want to find the child element whose name attribute is 
theParamDesired -- every time I find this attribute I want to call a 
setValue(theValueISeek) method on some object.  I want to ignore all 
other child elements which have different name/value attributes.  I'm 
not all that comfortable with manipulating the stack with a custom Rule 
implementation. 

I chose to use digester because it's usually a very fast and simple way 
to get my XML parsing needs satisfied (well, at least for SAX parsing).  
Plus, I'm working with a high volume of messages to parse, so SAX is 
appropriate here.

So do I need to create a custom rule here?  I don't think I missed a 
convenience method that already exists that would cover this issue, but 
I could be wrong.  If I do need to create a custom Rule, I suppose I 
could take a look at the source for some of the Rule classes that exist 
now.  I figure this is a common pattern to encounter and that I'm just 
missing the obvious here.  Any direction would be greatly appreciated.

Thanks in advance.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message