commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janek Bogucki <...@studylink.com>
Subject [digester] Rule for processing instruction?
Date Tue, 11 Mar 2003 16:31:55 GMT
I would like to build a map of processing instruction targets and data using
Digester. I can do this by extending Digester

    class PIDigester extends Digester {

        ...constructors...

        public void processingInstruction (
            String target,
            String data
        ) {

            super.processingInstruction ( target, data ) ;
            myMap.put ( target, data ) ;

        }
    }

I'd prefer to collect this information by adding a Rule to a Digester
instance, something similar to this:

    HashMap m = new HashMap () ; // or MultiHashMap
    digester.addRule ( "processing-instruction()", new PIRule ( m ) ) ;

Then this document

    <?xml version="1.0"?>
    <?origin     pg?>
    <?origin-alt fd?>
    <root/>

would result in this map:

    origin:     pg
    origin-alt: fd

Does anyone know if this is already possible or if something similar can be
done without extending Digester?

Many Thanks,
Janek


Mime
View raw message