返回顶部

收藏

自定义JDOM工厂类:Custom JDOM Factory

更多

CustomJDOMFactory.java

package javaxml2;

import org.jdom.Element;
import org.jdom.Namespace;
import org.jdom.input.DefaultJDOMFactory;

/**
 * <b><code>CustomJDOMFactory</code></b> is an example of providing
 *   user-defined JDOM subclasses when building a JDOM <code>Do*****ent</code>;
 *   this is instead of the default JDOM classes. This particular
 *   implementation returns a custom <code>Element</code> subclass,
 *   <code>{@link ORAElement}</code>.
 */
class CustomJDOMFactory extends DefaultJDOMFactory {

    public Element element(String name) {
        return new ORAElement(name);
    }

    public Element element(String name, Namespace ns) {
        return new ORAElement(name, ns);
    }

    public Element element(String name, String uri) {
        return new ORAElement(name, uri);
    }

    public Element element(String name, String prefix, String uri) {
        return new ORAElement(name, prefix, uri);
    }
}

标签:jQuery,XML,JDOM

收藏

0人收藏

支持

0

反对

0

发表评论