/** Copy constructor from non-subclassed elements */ public static AbstractEditorElement createEditorElement(Element element) { AbstractEditorElement newElement = null; String tag = element.getLocalName(); if (tag == null || tag.equals("")) { throw new RuntimeException("no tag"); } else if (tag.equals(CombineElement.TAG)) { newElement = new CombineElement(); } else if (tag.equals(ConstantElement.TAG)) { newElement = new ConstantElement(); } else if (tag.equals(EditorElement.TAG)) { newElement = new EditorElement(); } else if (tag.equals(FieldElement.TAG)) { newElement = new FieldElement(); } else if (tag.equals(PatternElement.TAG)) { newElement = new PatternElement(); } else if (tag.equals(PatternListElement.TAG)) { newElement = new PatternListElement(); } else if (tag.equals(SpaceElement.TAG)) { newElement = new SpaceElement(); } else if (tag.equals(SubstitutionElement.TAG)) { newElement = new SubstitutionElement(); } else { throw new RuntimeException("unsupported editor element: " + tag); } if (newElement != null) { XMLUtil.copyAttributes(element, newElement); createSubclassedChildren(element, newElement); } return newElement; }