Example usage for org.apache.commons.digester Digester addSetProperties

List of usage examples for org.apache.commons.digester Digester addSetProperties

Introduction

In this page you can find the example usage for org.apache.commons.digester Digester addSetProperties.

Prototype

public void addSetProperties(String pattern, String[] attributeNames, String[] propertyNames) 

Source Link

Document

Add a "set properties" rule with overridden parameters.

Usage

From source file:net.sf.jasperreports.customvisualization.xml.CVDigester.java

protected static void addEvaluationPropertiesRules(Digester digester, String pattern) {
    digester.addSetProperties(pattern,
            // properties to be ignored by this rule
            new String[] { JRXmlConstants.ATTRIBUTE_evaluationTime, CVXmlFactory.ATTRIBUTE_onErrorType },
            new String[0]);

    digester.addRule(pattern, new XmlConstantPropertyRule(JRXmlConstants.ATTRIBUTE_evaluationTime,
            "evaluationTimeValue", EvaluationTimeEnum.values()));

    digester.addRule(pattern,/*from w w  w.ja  va 2  s .  c  o  m*/
            new XmlConstantPropertyRule(CVXmlFactory.ATTRIBUTE_onErrorType, OnErrorTypeEnum.values()));
}

From source file:com.adito.httpunit.HttpTestParser.java

static HttpTestContainer generateTests(String path) throws IOException {
    try {// ww  w .  ja va 2 s .  c  o m
        Digester digester = new Digester();
        digester.setValidating(false);

        digester.addObjectCreate(MATCH_TESTS, HttpTestContainer.class);
        digester.addSetProperties(MATCH_TESTS, "rootUrl", "rootUrl");
        digester.addSetProperties(MATCH_TESTS, "port", "port");
        digester.addSetProperties(MATCH_TESTS, "defaultUsername", "defaultUsername");
        digester.addSetProperties(MATCH_TESTS, "defaultPassword", "defaultPassword");

        digester.addObjectCreate(MATCH_TEST, HttpTestEntry.class);
        digester.addSetProperties(MATCH_TEST, "name", "name");
        digester.addSetProperties(MATCH_TEST, "authenticated", "authenticated");
        digester.addSetProperties(MATCH_TEST, "username", "username");
        digester.addSetProperties(MATCH_TEST, "password", "password");

        digester.addObjectCreate(MATCH_TEST_STEP, HttpTestEntryStep.class);
        digester.addSetProperties(MATCH_TEST_STEP, "name", "name");
        digester.addSetProperties(MATCH_TEST_STEP, "method", "method");
        digester.addSetProperties(MATCH_TEST_STEP, "url", "url");
        digester.addSetProperties(MATCH_TEST_STEP, "expectedCode", "expectedCode");
        digester.addSetProperties(MATCH_TEST_STEP, "redirectUrl", "redirectUrl");

        digester.addObjectCreate(MATCH_PARAMETER, HttpTestEntryStep.Parameter.class);
        digester.addSetProperties(MATCH_PARAMETER, "key", "key");
        digester.addSetProperties(MATCH_PARAMETER, "value", "value");
        digester.addSetNext(MATCH_PARAMETER, "addParameter");

        digester.addObjectCreate(MATCH_MESSAGE, HttpTestEntryStep.Value.class);
        digester.addSetProperties(MATCH_MESSAGE, "value", "value");
        digester.addSetNext(MATCH_MESSAGE, "addMessage");

        digester.addObjectCreate(MATCH_ERROR, HttpTestEntryStep.Value.class);
        digester.addSetProperties(MATCH_ERROR, "value", "value");
        digester.addSetNext(MATCH_ERROR, "addError");

        digester.addSetNext(MATCH_TEST_STEP, "addStep");
        digester.addSetNext(MATCH_TEST, "addEntry");

        InputStream input = new FileInputStream(path);
        return (HttpTestContainer) digester.parse(input);
    } catch (SAXException e) {
        throw new IOException(e.getMessage());
    }
}

From source file:net.sf.jasperreports.components.sort.SortComponentDigester.java

public static void addSortComponentRules(Digester digester) {
    String componentNamespace = digester.getRuleNamespaceURI();

    String sortComponentPattern = "*/componentElement/sort";
    digester.addObjectCreate(sortComponentPattern, SortComponent.class.getName());

    digester.addSetProperties(sortComponentPattern, new String[] { SortComponent.PROPERTY_EVALUATION_TIME, },
            new String[0]);

    digester.addRule(sortComponentPattern,
            new XmlConstantPropertyRule(SortComponent.PROPERTY_EVALUATION_TIME, EvaluationTimeEnum.values()));

    digester.addFactoryCreate(sortComponentPattern + "/symbol", SortComponentSymbolFactory.class.getName());

    digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);

    digester.addFactoryCreate(sortComponentPattern + "/symbol/font",
            SortComponentSymbolFontFactory.class.getName());
    digester.addSetNext(sortComponentPattern + "/symbol/font", "setSymbolFont", JRFont.class.getName());

    digester.setRuleNamespaceURI(componentNamespace);
}

From source file:net.sf.jasperreports.components.iconlabel.IconLabelComponentDigester.java

public static void addIconLabelComponentRules(Digester digester) {
    String componentNamespace = digester.getRuleNamespaceURI();

    String iconLabelComponentPattern = "*/componentElement/iconLabel";
    digester.addFactoryCreate(iconLabelComponentPattern, IconLabelComponentFactory.class.getName());

    digester.addSetProperties(iconLabelComponentPattern,
            new String[] { IconLabelComponent.PROPERTY_ICON_POSITION, IconLabelComponent.PROPERTY_LABEL_FILL,
                    IconLabelComponent.PROPERTY_HORIZONTAL_ALIGNMENT,
                    IconLabelComponent.PROPERTY_VERTICAL_ALIGNMENT },
            new String[0]);

    digester.addRule(iconLabelComponentPattern,
            new XmlConstantPropertyRule(IconLabelComponent.PROPERTY_ICON_POSITION, IconPositionEnum.values()));
    digester.addRule(iconLabelComponentPattern,
            new XmlConstantPropertyRule(IconLabelComponent.PROPERTY_LABEL_FILL, ContainerFillEnum.values()));
    digester.addRule(iconLabelComponentPattern,
            new XmlConstantPropertyRule(IconLabelComponent.PROPERTY_HORIZONTAL_ALIGNMENT,
                    "horizontalImageAlign", HorizontalImageAlignEnum.values()));
    digester.addRule(iconLabelComponentPattern,
            new XmlConstantPropertyRule(IconLabelComponent.PROPERTY_VERTICAL_ALIGNMENT, "verticalImageAlign",
                    VerticalImageAlignEnum.values()));

    digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);

    digester.addFactoryCreate(iconLabelComponentPattern + "/label/textField",
            LabelTextFieldFactory.class.getName());
    digester.addFactoryCreate(iconLabelComponentPattern + "/icon/textField",
            IconTextFieldFactory.class.getName());

    digester.setRuleNamespaceURI(componentNamespace);
}

From source file:com.projity.configuration.FieldDictionary.java

public static void addDigesterEvents(Digester digester) {
    //      digester.addObjectCreate("*/fieldDictionary", "com.projity.configuration.FieldDictionary");
    digester.addFactoryCreate("*/fieldDictionary", "com.projity.configuration.FieldDictionaryFactory");
    digester.addSetNext("*/fieldDictionary", "setFieldDictionary", "com.projity.configuration.FieldDictionary"); //TODO can we do this more easily
    digester.addSetProperties("*/fieldDictionary/class", "name", "className"); // object is field dictionary
    digester.addObjectCreate("*/fieldDictionary/class/field", "com.projity.field.Field");
    digester.addSetProperties("*/fieldDictionary/class/field");
    digester.addSetNext("*/fieldDictionary/class/field", "addField", "com.projity.field.Field");

    digester.addObjectCreate("*/field/select", "com.projity.field.StaticSelect"); // create a select
    digester.addSetProperties("*/field/select"); // set name of select
    digester.addSetNext("*/field/select", "setSelect", "com.projity.field.StaticSelect"); // attach to field

    digester.addObjectCreate("*/field/choice", "com.projity.field.DynamicSelect"); // create a cohice
    digester.addSetProperties("*/field/choice"); // set name of choice, finder and list methods
    digester.addSetNext("*/field/choice", "setSelect", "com.projity.field.DynamicSelect"); // attach to field

    digester.addObjectCreate("*/field/select/option", "com.projity.field.SelectOption"); // create an option when seeing one
    digester.addSetProperties("*/field/select/option"); // get key and value properties
    digester.addSetNext("*/field/select/option", "addOption", "com.projity.field.SelectOption"); // add option to select

    digester.addObjectCreate("*/field/range", "com.projity.field.Range"); // create an option when seeing one
    digester.addSetProperties("*/field/range"); // get key and value properties
    digester.addSetNext("*/field/range", "setRange", "com.projity.field.Range"); // add option to select

    //non intrusive method to reduce role options, otherwise Select should be modified to depend on a specific object
    digester.addObjectCreate("*/field/filter", "com.projity.field.OptionsFilter");
    digester.addSetProperties("*/field/filter");
    digester.addSetNext("*/field/filter", "setFilter", "com.projity.field.OptionsFilter");

    String fieldAccessibleClass = Messages.getMetaString("FieldAccessible");
    digester.addObjectCreate("*/field/permission", fieldAccessibleClass);
    digester.addSetProperties("*/field/permission");
    digester.addSetNext("*/field/permission", "setAccessControl", "com.projity.field.FieldAccessible");

}

From source file:com.frameworkset.common.tag.export.properties.ConfigFactory.java

/**
 * ?xml???/* w w w .  j ava  2  s.co m*/
 * @param force
 * @return Configture
 */
public static Configture createConfigure(boolean force) {
    Digester digester = new Digester();
    digester.setValidating(false);
    if (configture == null || force) {
        configture = new Configture();

        digester.push(configture);
        // This set of rules calls the addDataSource method and passes
        // in five parameters to the method.
        digester.addBeanPropertySetter("exportconfig/description", "description");

        digester.addBeanPropertySetter("exportconfig/version", "version");
        digester.addObjectCreate("exportconfig/export", ExportConfig.class);
        digester.addBeanPropertySetter("exportconfig/export/description", "description");
        digester.addSetProperties("exportconfig/export/config", new String[] { "name", "type", "class" },
                new String[] { "name", "type", "exportClass" });
        digester.addSetNext("exportconfig/export", "addExportConfig");
        ClassLoader classLoader = ConfigFactory.class.getClassLoader();
        URL url = classLoader.getResource("export.xml");
        try {
            digester.parse(url.openStream());
        } catch (IOException e) {
            e.printStackTrace();
        } catch (SAXException e) {

            e.printStackTrace();
        }

    }
    return configture;
}

From source file:com.change_vision.astah.extension.plugin.cplusreverse.reverser.DoxygenXmlParser.java

/**
 * //w  w w  . j ava2  s .  c  o  m
 * @param file
 *            : target file
 * @return the Compounddef
 * @throws IOException
 * @throws SAXException
 */
public static CompoundDef parserCompounddefXML(File file) throws IOException, SAXException {
    // init digester for parser class.xml or interface.xml...
    Digester digester = new DoxygenDigester();
    digester.setValidating(false);
    // create the Compounddef
    digester.addRule("doxygen/compounddef", new ObjectCreateAfterLanguageRule(CompoundDef.class));
    digester.addSetProperties("doxygen/compounddef", "id", "compounddefId");
    digester.addSetProperties("doxygen/compounddef", "prot", "compounddefVisible");
    digester.addSetProperties("doxygen/compounddef", "kind", "compounddefKind");
    digester.addBeanPropertySetter("doxygen/compounddef/compoundname", "compoundName");

    // crreate the TempleParam
    digester.addRule("doxygen/compounddef/templateparamlist/param",
            new ObjectCreateAfterLanguageRule(TempleParam.class));
    digester.addBeanPropertySetter("doxygen/compounddef/templateparamlist/param/type", "type");
    digester.addBeanPropertySetter("doxygen/compounddef/templateparamlist/param/declname", "declname");
    digester.addBeanPropertySetter("doxygen/compounddef/templateparamlist/param/defname", "defname");
    digester.addBeanPropertySetter("doxygen/compounddef/templateparamlist/param/defval", "defval");
    digester.addRule("doxygen/compounddef/templateparamlist/param/defval/ref",
            new ObjectCreateAfterLanguageRule(Ref.class));
    digester.addSetProperties("doxygen/compounddef/templateparamlist/param/defval/ref", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/templateparamlist/param/defval/ref", "refid", "kindref");
    digester.addBeanPropertySetter("doxygen/compounddef/templateparamlist/param/defval/ref", "value");
    digester.addSetNext("doxygen/compounddef/templateparamlist/param/defval/ref", "setDefaultValue");

    digester.addSetNext("doxygen/compounddef/templateparamlist/param", "addTemplateParam");

    // create the BaseCompounddefref
    digester.addRule("doxygen/compounddef/basecompoundref",
            new ObjectCreateAfterLanguageRule(BaseCompoundDefRef.class));
    digester.addSetProperties("doxygen/compounddef/basecompoundref", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/basecompoundref", "prot", "prot");
    digester.addSetProperties("doxygen/compounddef/basecompoundref", "virt", "virt");
    digester.addBeanPropertySetter("doxygen/compounddef/basecompoundref", "value");
    digester.addSetNext("doxygen/compounddef/basecompoundref", "addBasecompoundList");

    // create the Derivedcompoundref
    digester.addRule("doxygen/compounddef/derivedcompoundref",
            new ObjectCreateAfterLanguageRule(DerivedCompoundRef.class));
    digester.addSetProperties("doxygen/compounddef/derivedcompoundref", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/derivedcompoundref", "prot", "prot");
    digester.addSetProperties("doxygen/compounddef/derivedcompoundref", "virt", "virt");
    digester.addBeanPropertySetter("doxygen/compounddef/derivedcompoundref", "value");
    digester.addSetNext("doxygen/compounddef/derivedcompoundref", "addDerivedcompoundList");

    // create the InnerClass
    digester.addRule("doxygen/compounddef/innerclass", new ObjectCreateAfterLanguageRule(InnerClass.class));
    digester.addSetProperties("doxygen/compounddef/innerclass", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/innerclass", "prot", "prot");
    digester.addSetNext("doxygen/compounddef/innerclass", "addInnerclass");

    // create the Innernamespace
    digester.addRule("doxygen/compounddef/innernamespace",
            new ObjectCreateAfterLanguageRule(InnerNameSpace.class));
    digester.addSetProperties("doxygen/compounddef/innernamespace", "refid", "refid");
    digester.addSetNext("doxygen/compounddef/innernamespace", "addInnernamespace");

    digester.addSetProperties("doxygen/compounddef/location", "file", "locationFile");
    digester.addSetProperties("doxygen/compounddef/location", "line", "locationLine");
    digester.addSetProperties("doxygen/compounddef/location", "bodyfile", "locationBodyFile");
    digester.addSetProperties("doxygen/compounddef/location", "bodystart", "locationBodyStart");
    digester.addSetProperties("doxygen/compounddef/location", "bodyend", "locationBodyEnd");
    //
    digester.addBeanPropertySetter("doxygen/compounddef/briefdescription/para", "briefdescriptionPara");
    digester.addBeanPropertySetter("doxygen/compounddef/detaileddescription/para", "detaileddescriptionPara");

    // create the Section
    digester.addRule("doxygen/compounddef/sectiondef", new ObjectCreateAfterLanguageRule(Section.class));
    digester.addSetProperties("doxygen/compounddef/sectiondef", "kind", "kind");
    digester.addSetNext("doxygen/compounddef/sectiondef", "addSection");

    // create the Member
    digester.addRule("doxygen/compounddef/sectiondef/memberdef",
            new ObjectCreateAfterLanguageRule(Member.class));
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "kind", "kind");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "id", "id");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "prot", "prot");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "const", "constBoolean");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "static", "staticBoolean");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "gettable", "gettable");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "settable", "settable");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "virt", "virt");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "explicit", "explicit");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "inline", "inline");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "mutable", "mutable");

    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/type", "type");
    digester.addRule("doxygen/compounddef/sectiondef/memberdef/type/ref",
            new ObjectCreateAfterLanguageRule(Ref.class));
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef/type/ref", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef/type/ref", "refid", "kindref");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/type/ref", "value");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef/type/ref", "addTypeRef");

    // resolve special initializer
    digester.addRule("doxygen/compounddef/sectiondef/memberdef/initializer", new InitBeanPropertySetterRule());

    digester.addRule("doxygen/compounddef/sectiondef/memberdef/enumvalue",
            new ObjectCreateAfterLanguageRule(EnumValue.class));
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/enumvalue/name", "name");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/enumvalue/initializer",
            "initializer");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/enumvalue/briefdescription",
            "briefdescription");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/enumvalue/detaileddescription",
            "detaileddescription");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef/enumvalue", "addEnum");

    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/name", "name");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/argsstring", "argsstring");

    // create the Param
    digester.addRule("doxygen/compounddef/sectiondef/memberdef/param",
            new ObjectCreateAfterLanguageRule(Param.class));
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/type", "type");
    digester.addRule("doxygen/compounddef/sectiondef/memberdef/param/type/ref",
            new ObjectCreateAfterLanguageRule(Ref.class));
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef/param/type/ref", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef/param/type/ref", "refid", "kindref");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/type/ref", "value");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef/param/type/ref", "addTypeRef");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/declname", "declname");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/defname", "defname");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/array", "array");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef/param", "addMemberParam");

    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/briefdescription/para",
            "briefdescriptionPara");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/detaileddescription/para",
            "detaileddescriptionPara");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef", "addMember");
    logger.debug("file:{}", file);
    return (CompoundDef) digester.parse(file);
}

From source file:jenkins.uvision.CoverageParser.java

public static TestRun parse(InputStream in) throws IOException {
    if (in == null)
        throw new NullPointerException();
    Digester digester = new Digester();
    digester.setClassLoader(CoverageParser.class.getClassLoader());

    digester.addObjectCreate("TestRun", TestRun.class);
    digester.addObjectCreate("TestRun/SuccessfulTests", SuccessfulTests.class);

    digester.addObjectCreate("TestRun/SuccessfulTests/Test", Test.class);
    digester.addBeanPropertySetter("TestRun/SuccessfulTests/Test/File", "file");
    digester.addBeanPropertySetter("TestRun/SuccessfulTests/Test/Name", "name");
    digester.addBeanPropertySetter("TestRun/SuccessfulTests/Test/Coverage", "coverage");
    digester.addBeanPropertySetter("TestRun/SuccessfulTests/Test/Instructions", "instructions");
    digester.addSetProperties("TestRun/SuccessfulTests/Test", "id", "id");
    digester.addSetProperties("TestRun/SuccessfulTests/Test", "duration", "duration");

    digester.addSetNext("TestRun/SuccessfulTests/Test", "addTest");
    digester.addSetNext("TestRun/SuccessfulTests", "addSuccessfullTests");

    digester.addObjectCreate("TestRun/Statistics", Statistics.class);
    digester.addBeanPropertySetter("TestRun/Statistics/Tests", "tests");
    digester.addBeanPropertySetter("TestRun/Statistics/FailuresTotal", "failuresTotal");
    digester.addBeanPropertySetter("TestRun/Statistics/Errors", "errors");
    digester.addBeanPropertySetter("TestRun/Statistics/Ignored", "ignored");
    digester.addBeanPropertySetter("TestRun/Statistics/Failures", "failures");
    digester.addBeanPropertySetter("TestRun/Statistics/Duration", "duration");

    digester.addSetNext("TestRun/Statistics", "addStatistics");
    digester.addSetNext("TestRun/Statistics", "setStatistics");

    try {/*w  w  w. ja va2 s . c om*/
        return (TestRun) digester.parse(in);
    } catch (SAXException e) {
        throw new IOException2("Cannot parse coverage results", e);
    }
}

From source file:com.change_vision.astah.extension.plugin.csharpreverse.reverser.DoxygenXmlParser.java

/**
 * /*from  ww  w.ja v  a 2s  .co  m*/
 * @param file
 *            : target file
 * @return the Compounddef
 * @throws IOException
 * @throws SAXException
 */
public static CompoundDef parserCompounddefXML(File file) throws IOException, SAXException {
    // init digester for parser class.xml or interface.xml...
    Digester digester = new DoxygenDigester();
    digester.setValidating(false);
    // create the Compounddef
    digester.addRule("doxygen/compounddef", new ObjectCreateAfterLanguageRule(CompoundDef.class));
    digester.addSetProperties("doxygen/compounddef", "id", "compounddefId");
    digester.addSetProperties("doxygen/compounddef", "prot", "compounddefVisible");
    digester.addSetProperties("doxygen/compounddef", "kind", "compounddefKind");
    digester.addBeanPropertySetter("doxygen/compounddef/compoundname", "compoundName");
    digester.addBeanPropertySetter("doxygen/compounddef/briefdescription/para", "briefdescriptionPara");
    digester.addBeanPropertySetter("doxygen/compounddef/detaileddescription/para", "detaileddescriptionPara");

    // crreate the TempleParam
    digester.addRule("doxygen/compounddef/templateparamlist/param",
            new ObjectCreateAfterLanguageRule(TemplateParam.class));
    digester.addBeanPropertySetter("doxygen/compounddef/templateparamlist/param/type", "type");
    digester.addBeanPropertySetter("doxygen/compounddef/templateparamlist/param/declname", "declname");
    digester.addBeanPropertySetter("doxygen/compounddef/templateparamlist/param/defname", "defname");
    digester.addBeanPropertySetter("doxygen/compounddef/templateparamlist/param/defval", "defval");
    digester.addSetNext("doxygen/compounddef/templateparamlist/param", "addTemplateParam");

    // create the BaseCompounddefref
    digester.addRule("doxygen/compounddef/basecompoundref",
            new ObjectCreateAfterLanguageRule(BaseCompoundDefRef.class));
    digester.addSetProperties("doxygen/compounddef/basecompoundref", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/basecompoundref", "prot", "prot");
    digester.addSetProperties("doxygen/compounddef/basecompoundref", "virt", "virt");
    digester.addBeanPropertySetter("doxygen/compounddef/basecompoundref", "value");
    digester.addSetNext("doxygen/compounddef/basecompoundref", "addBasecompoundList");

    // create the Derivedcompoundref
    digester.addRule("doxygen/compounddef/derivedcompoundref",
            new ObjectCreateAfterLanguageRule(DerivedCompoundRef.class));
    digester.addSetProperties("doxygen/compounddef/derivedcompoundref", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/derivedcompoundref", "prot", "prot");
    digester.addSetProperties("doxygen/compounddef/derivedcompoundref", "virt", "virt");
    digester.addBeanPropertySetter("doxygen/compounddef/derivedcompoundref", "value");
    digester.addSetNext("doxygen/compounddef/derivedcompoundref", "addDerivedcompoundList");

    // create the InnerClass
    digester.addRule("doxygen/compounddef/innerclass", new ObjectCreateAfterLanguageRule(InnerClass.class));
    digester.addSetProperties("doxygen/compounddef/innerclass", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/innerclass", "prot", "prot");
    digester.addSetNext("doxygen/compounddef/innerclass", "addInnerclass");

    // create the Innernamespace
    digester.addRule("doxygen/compounddef/innernamespace",
            new ObjectCreateAfterLanguageRule(InnerNameSpace.class));
    digester.addSetProperties("doxygen/compounddef/innernamespace", "refid", "refid");
    digester.addSetNext("doxygen/compounddef/innernamespace", "addInnernamespace");

    digester.addSetProperties("doxygen/compounddef/location", "file", "locationFile");
    digester.addSetProperties("doxygen/compounddef/location", "line", "locationLine");
    digester.addSetProperties("doxygen/compounddef/location", "bodyfile", "locationBodyFile");
    digester.addSetProperties("doxygen/compounddef/location", "bodystart", "locationBodyStart");
    digester.addSetProperties("doxygen/compounddef/location", "bodyend", "locationBodyEnd");
    //
    digester.addBeanPropertySetter("doxygen/compounddef/detaileddescription/para", "detaileddescriptionPara");

    // create the Section
    digester.addRule("doxygen/compounddef/sectiondef", new ObjectCreateAfterLanguageRule(Section.class));
    digester.addSetProperties("doxygen/compounddef/sectiondef", "kind", "kind");
    digester.addSetNext("doxygen/compounddef/sectiondef", "addSection");

    // create the Member
    digester.addRule("doxygen/compounddef/sectiondef/memberdef",
            new ObjectCreateAfterLanguageRule(Member.class));
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "kind", "kind");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "id", "id");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "prot", "prot");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "const", "constBoolean");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "static", "staticBoolean");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "gettable", "gettable");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "settable", "settable");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef", "virt", "virt");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/briefdescription/para",
            "briefdescriptionPara");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/detaileddescription/para",
            "detaileddescriptionPara");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/detaileddescription/para/"
            + "parameterlist/parameteritem/parameternamelist/parametername", "parametername");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/detaileddescription/para/"
            + "parameterlist/parameteritem/parameterdescription/para", "parameterdescriptionPara");
    digester.addBeanPropertySetter(
            "doxygen/compounddef/sectiondef/memberdef/detaileddescription/para/simplesect/para",
            "simplesectPara");

    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/type", "type");
    digester.addRule("doxygen/compounddef/sectiondef/memberdef/type/ref",
            new ObjectCreateAfterLanguageRule(Ref.class));
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef/type/ref", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef/type/ref", "refid", "kindref");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/type/ref", "value");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef/type/ref", "addTypeRef");

    // resolve special initializer
    digester.addRule("doxygen/compounddef/sectiondef/memberdef/initializer", new InitBeanPropertySetterRule());

    digester.addRule("doxygen/compounddef/sectiondef/memberdef/enumvalue",
            new ObjectCreateAfterLanguageRule(EnumValue.class));
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/enumvalue/name", "name");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/enumvalue/initializer",
            "initializer");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/enumvalue/briefdescription",
            "briefdescription");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/enumvalue/detaileddescription",
            "detaileddescription");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef/enumvalue", "addEnum");

    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/name", "name");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/argsstring", "argsstring");

    // create the Param
    digester.addRule("doxygen/compounddef/sectiondef/memberdef/param",
            new ObjectCreateAfterLanguageRule(Param.class));
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/type", "type");
    digester.addRule("doxygen/compounddef/sectiondef/memberdef/param/type/ref",
            new ObjectCreateAfterLanguageRule(Ref.class));
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef/param/type/ref", "refid", "refid");
    digester.addSetProperties("doxygen/compounddef/sectiondef/memberdef/param/type/ref", "refid", "kindref");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/type/ref", "value");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef/param/type/ref", "addTypeRef");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/declname", "declname");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/defname", "defname");
    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/param/array", "array");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef/param", "addMemberParam");

    digester.addBeanPropertySetter("doxygen/compounddef/sectiondef/memberdef/detaileddescription/para",
            "detaileddescriptionPara");
    digester.addSetNext("doxygen/compounddef/sectiondef/memberdef", "addMember");

    logger.trace(String.format("%s", file));
    return (CompoundDef) digester.parse(file);
}

From source file:net.javacoding.xsearch.config.ServerConfigurationRuleSet.java

/**
 * Add the set of Rule instances defined in this RuleSet to the specified
 * <code>Digester</code> instance, associating them with our namespace URI
 * (if any). This method should only be called by a Digester instance.
 * These rules assume that an instance of
 * <code>net.javacoding.xsearch.config.ServerConfiguration</code> is pushed
 * onto the evaluation stack before parsing begins.
 *
 * @param digester Digester instance to which the new Rule instances should
 *                 be added.//from   ww w  .ja va 2 s  . c o m
 */
public void addRuleInstances(Digester digester) {
    digester.addSetProperties("xsearch", "basedir", "basedir");
    digester.addSetProperties("xsearch", "password", "password");
    digester.addSetProperties("xsearch", "adminuser", "adminUser");

    digester.addBeanPropertySetter("xsearch/index-root-directory", "indexRootDirectory");
    digester.addBeanPropertySetter("xsearch/is-merging-old-dataset-values", "isMergingOldDatasetValues");
    digester.addBeanPropertySetter("xsearch/search-log-size-in-MB", "searchLogSizeInMB");
    digester.addBeanPropertySetter("xsearch/indexing-log-size-in-MB", "indexingLogSizeInMB");
    digester.addBeanPropertySetter("xsearch/is-short-indexing-log-enabled", "isShortIndexingLogEnabled");

    digester.addBeanPropertySetter("xsearch/registration-information/version", "licenseVersion");
    digester.addBeanPropertySetter("xsearch/registration-information/user", "user");
    digester.addBeanPropertySetter("xsearch/registration-information/license-level", "licenseLevel");
    digester.addBeanPropertySetter("xsearch/registration-information/max-index-size", "maxIndexSize");
    digester.addBeanPropertySetter("xsearch/registration-information/start-date", "startDate");
    digester.addBeanPropertySetter("xsearch/registration-information/upgrade-end-date", "upgradeEndDate");
    digester.addBeanPropertySetter("xsearch/registration-information/end-date", "endDate");
    digester.addBeanPropertySetter("xsearch/registration-information/registration-number",
            "registrationNumber");
    digester.addBeanPropertySetter("xsearch/registration-information/host-ip-list", "allowedIpsString");
    digester.addBeanPropertySetter("xsearch/registration-information/registration-code", "registrationCode");

    digester.addObjectCreate("xsearch/logging-configuration",
            "net.javacoding.xsearch.config.LoggingConfiguration");
    digester.addBeanPropertySetter("xsearch/logging-configuration/enabled", "isEnabled");
    digester.addBeanPropertySetter("xsearch/logging-configuration/smtp-host", "smtpHost");
    digester.addBeanPropertySetter("xsearch/logging-configuration/smtp-port", "smtpPort");
    digester.addBeanPropertySetter("xsearch/logging-configuration/to-address", "toAddress");
    digester.addBeanPropertySetter("xsearch/logging-configuration/from-address", "fromAddress");
    digester.addBeanPropertySetter("xsearch/logging-configuration/threshold", "threshold");
    digester.addSetNext("xsearch/logging-configuration", "setLoggingConfiguration");

    digester.addObjectCreate("xsearch/data-source", "net.javacoding.xsearch.config.DataSource");
    digester.addBeanPropertySetter("xsearch/data-source/name", "name");
    digester.addBeanPropertySetter("xsearch/data-source/driver-directory-name", "driverDirectoryName");
    digester.addBeanPropertySetter("xsearch/data-source/jdbcdriver", "jdbcdriver");
    digester.addRule("xsearch/data-source/db-url", new ServerDataSourceRule());
    digester.addRule("xsearch/data-source/db-username", new ServerDataSourceRule());
    digester.addRule("xsearch/data-source/db-password", new ServerDataSourceRule());
    digester.addBeanPropertySetter("xsearch/data-source/dbcp-validation-query", "dbcpValidationQuery");
    digester.addSetNext("xsearch/data-source", "setServerDataSource");

    digester.addObjectCreate("xsearch/instance-job-schedules/instance-job-schedule",
            "net.javacoding.xsearch.config.InstanceJobSchedule");
    digester.addSetProperties("xsearch/instance-job-schedules/instance-job-schedule", "id", "id");
    digester.addBeanPropertySetter("xsearch/instance-job-schedules/instance-job-schedule/schedule-name",
            "scheduleName");
    digester.addBeanPropertySetter("xsearch/instance-job-schedules/instance-job-schedule/job-data-string",
            "jobDataString");
    digester.addObjectCreate("xsearch/instance-job-schedules/instance-job-schedule/schedule",
            "net.javacoding.xsearch.config.Schedule");
    digester.addSetProperties("xsearch/instance-job-schedules/instance-job-schedule/schedule", "id", "id");
    digester.addBeanPropertySetter("xsearch/instance-job-schedules/instance-job-schedule/schedule/is-enabled",
            "isEnabled");
    digester.addBeanPropertySetter("xsearch/instance-job-schedules/instance-job-schedule/schedule/is-interval",
            "isInterval");
    digester.addBeanPropertySetter("xsearch/instance-job-schedules/instance-job-schedule/schedule/interval",
            "interval");
    digester.addBeanPropertySetter("xsearch/instance-job-schedules/instance-job-schedule/schedule/cron-setting",
            "cronSetting");
    digester.addSetNext("xsearch/instance-job-schedules/instance-job-schedule/schedule", "setSchedule");
    digester.addSetNext("xsearch/instance-job-schedules/instance-job-schedule", "setInstanceJobSchedule");

    //database connection setting, preserved for upgrading purpose
    digester.addBeanPropertySetter("xsearch/jdbcdriver", "jdbcdriver");
    digester.addBeanPropertySetter("xsearch/db-url", "dbUrl");
    digester.addBeanPropertySetter("xsearch/db-username", "dbUsername");
    digester.addBeanPropertySetter("xsearch/db-password", "dbPassword");
    digester.addBeanPropertySetter("xsearch/dbcp-validation-query", "dbcpValidationQuery");

}