@Override public void characters(char[] arg0, int arg1, int arg2) throws SAXException { if (ItemContentHandlerParseState.DCTITLE.equals(parseState) || ItemContentHandlerParseState.PGNAME.equals(parseState)) { stringBuilder.append(Arrays.copyOfRange(arg0, arg1, arg1 + arg2)); } }
@Override public void endElement(String arg0, String arg1, String arg2) throws SAXException { if (ItemContentHandlerParseState.DCTITLE.equals(parseState)) { if (itemResult.getTitle() == null) { itemResult.setTitle(new ArrayList<String>()); } itemResult.getTitle().add(stringBuilder.toString()); } if (ItemContentHandlerParseState.PGNAME.equals(parseState)) { if (itemResult.getAuthors() == null) { itemResult.setAuthors(new ArrayList<String>()); } itemResult.getAuthors().add(stringBuilder.toString()); } if ("dcterms:title".equals(arg2)) { parseState = ItemContentHandlerParseState.UNKNOWN; } if ("pgterms:name".equals(arg2)) { parseState = ItemContentHandlerParseState.UNKNOWN; } }