commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Keese <>
Subject Re: [digester] Unhandled element and attributes
Date Mon, 17 Jan 2005 00:03:32 GMT

>Do any rules exist that will execute if an unexpected element or attribute
>is encountered in an XML file.
You are looking for something other than the standard schema validation, 
right?  Here's what I did:

        digester.setRules(new ExtendedBaseRules());

        // add all your normal rules here

        digester.addRule("*/?", new Rule() {
            public void begin(java.lang.String namespace, 
java.lang.String name, org.xml.sax.Attributes attributes)
            throws Exception{
                throw new Exception("Unknown tag " + name);

This is like the "default" tag in a "case" statement, that only fires if 
none of the other conditions match.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message