ProcessingOrder (CharSequence localName, String namespace, int startoffset, int endoffset, int headerEndOffset) { String name = localName.toString(); if (StringUtil.isEmptyOrSpaces(name)) return ProcessingOrder.TAGS; Element newElement; try { newElement = new Element(name); } catch (IllegalNameException e) { newElement = new Element("invalidName"); } Element parent = stack.isEmpty() ? null : stack.getLast(); if (parent == null) { result[0] = newElement; } else { parent.addContent(newElement); } stack.addLast(newElement); return ProcessingOrder.TAGS_AND_TEXTS; }