Header

  1. View current page

    정상혁의 수첩

Profile_img_60x60_08
195

Digester

Digester

Parsing and Processing Large XML Documents with Digester Rules

Jakarta Digester 학습하기

Using the digester component

Digester 사용법

Digester/FAQ

Digester/FAQ/XmlRulesOrNotXmlRules

 

event 기반인 SAX를 내부적으로 사용

Digester 클래스는 org.xml.sax.ContentHandler를 구현하고 있으며, parse stack를 관리하고

 

Rule 샘플

package prototype.common;

import java.util.Map;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.digester.BeanPropertySetterRule;

 

public class BeanAndMapPropertySetterRule extends BeanPropertySetterRule {
   
    public BeanAndMapPropertySetterRule(String propertyName){
        super(propertyName);
    }
    public void end(String namespace, String name)    throws Exception{
        Object top = digester.peek();
        if(top instanceof Map)  {
            PropertyUtils.setProperty(top, propertyName, bodyText);
        } else {
            super.end(namespace,name);
        }
    }
}

 

History

Last edited on 09/08/2008 11:55 by benelog

Comments (0)

You must log in to leave a comment. Please sign in.