On Wednesday, May 1, 2002, at 08:23  PM, Craig R. McClanahan wrote:

...

>> Yup. This works fine. Digester is a great tool! One thing I'm looking 
>> at
>> is how to combine it with a set of regular expression rules for the
>> elements and attributes. Something like:
>>
>>   <command id="123">
>>     <user username="stefan"/>
>>   </command>
>>
>> With a property list:
>>
>>   command.id=/^\d+$/
>>   user.username=/^[a-z0-9]+$/
>>
>> And make this part of the validation process. I'm interested in your
>> thoughts about this. Is this something to add to the Digester core code
>> or something that I should move to my own classes?
>>
>
> Do you mean that you want to ensure that the attributes match those
> patterns?  Personally, I think that's a little out of scope for 
> Digester,
> although you could probably do it by implementing your own matching
> algorithm in an org.apache.commons.digester.Rules implementation (either
> don't select the rules on mismatched patterns, or throw an exception or
> something).  Another alternative would be to throw an exception in the
> property setter of the beans being created.

Hmm. I had not thought about the property setter. My problem is that I 
need to give feedback to the user about where exactly in the XML 
document the wrong input was given. Preferably with a line number. Is 
there a way to get that information from the parser, or is all that 
logic buried deep in the Digester class?

  Stefan


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

Reply via email to