@Override public Object createObject(Attributes attributes) throws Exception { 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 + ". This attribute is optional or can have a value of element|fragment."); } } }
public Object createObject(Attributes attributes) throws Exception { 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 + ". This attribute is optional or can have a value of element|fragment."); } } }