Package org.apache.commons.digester

Examples of org.apache.commons.digester.NodeCreateRule


            String nodeType = attributes.getValue("type");
            if (nodeType == null || "".equals(nodeType)) {

                // uses Node.ELEMENT_NODE
                return new NodeCreateRule();
            } else if ("element".equals(nodeType)) {

                return new NodeCreateRule(Node.ELEMENT_NODE);
            } else if ("fragment".equals(nodeType)) {

                return new NodeCreateRule(Node.DOCUMENT_FRAGMENT_NODE);
            } else {

                throw new RuntimeException(
                        "Unrecognized node type: "
                                + nodeType
View Full Code Here


            String nodeType = attributes.getValue("type");
            if (nodeType == null || "".equals(nodeType)) {

                // uses Node.ELEMENT_NODE
                return new NodeCreateRule();
            } else if ("element".equals(nodeType)) {

                return new NodeCreateRule(Node.ELEMENT_NODE);
            } else if ("fragment".equals(nodeType)) {

                return new NodeCreateRule(Node.DOCUMENT_FRAGMENT_NODE);
            } else {

                throw new RuntimeException(
                        "Unrecognized node type: "
                                + nodeType
View Full Code Here

            String nodeType = attributes.getValue("type");
            if (nodeType == null || "".equals(nodeType)) {

                // uses Node.ELEMENT_NODE
                return new NodeCreateRule();
            } else if ("element".equals(nodeType)) {

                return new NodeCreateRule(Node.ELEMENT_NODE);
            } else if ("fragment".equals(nodeType)) {

                return new NodeCreateRule(Node.DOCUMENT_FRAGMENT_NODE);
            } else {

                throw new RuntimeException(
                        "Unrecognized node type: "
                                + nodeType
View Full Code Here

        try {
            //tested with digester: XML displayed as a jhoveTreeNode
            XMPasString = XMPasString.substring(1, XMPasString.length() - 1);
           
            Digester digester=new Digester();
            digester.addRule("XMPInfo", new NodeCreateRule());
           
            Node rootNode = (Node)digester.parse(
                    new StringReader("<XMPInfo>" + XMPasString + "</XMPInfo>"));
           
            return getJHoveTreeNodeFromXPathNode(rootNode);
View Full Code Here

            try {
                // object-create rules are called at the beginning element-tags, in the same order as defined
                // first create the wrapper
                digester.addObjectCreate("*/plan/executablePlan/planWorkflow", NodeContentWrapper.class);
                // then an element for workflowConf
                digester.addRule("*/plan/executablePlan/planWorkflow/workflowConf", new NodeCreateRule());
               
                // CallMethod and SetNext rules are called at closing element-tags, (last in - first out!)
               
                CallMethodRule rr = new CallMethodRule(1, "setNodeContent", 2);
                digester.addRule("*/plan/executablePlan/planWorkflow/workflowConf", rr);
                // right below the wrapper is an instance of ExecutablePlanDefinition 
                digester.addCallParam("*/plan/executablePlan/planWorkflow/workflowConf", 0 , 1);
                // provide the name of the setter method
                digester.addObjectParam("*/plan/executablePlan/planWorkflow/workflowConf", 1, "setExecutablePlan");
   
                // the generated node is not accessible as CallParam (why?!?), but available for addSetNext
                digester.addSetNext("*/plan/executablePlan/planWorkflow/workflowConf", "setNode");

            } catch (ParserConfigurationException e) {
                PlatoLogger.getLogger(this.getClass()).error(e.getMessage(),e);
            }

            //
            // Import EPrints executable plan if present
            //
            try {
               
                digester.addObjectCreate("*/plan/executablePlan/eprintsPlan", NodeContentWrapper.class);
                // then an element for workflowConf
                digester.addRule("*/plan/executablePlan/eprintsPlan", new NodeCreateRule());
               
                CallMethodRule rr2 = new CallMethodRule(1, "setNodeContentEPrintsPlan", 2);
                digester.addRule("*/plan/executablePlan/eprintsPlan", rr2);
                // right below the wrapper is an instance of ExecutablePlanDefinition 
                digester.addCallParam("*/plan/executablePlan/eprintsPlan", 0 , 1);
View Full Code Here

TOP

Related Classes of org.apache.commons.digester.NodeCreateRule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.