List of usage examples for javax.xml.stream XMLInputFactory IS_COALESCING
String IS_COALESCING
To view the source code for javax.xml.stream XMLInputFactory IS_COALESCING.
Click Source Link
From source file:org.wso2.carbon.governance.api.endpoints.dataobjects.EndpointImpl.java
public OMElement buildOMElement(String content) throws GovernanceException { XMLStreamReader parser;/*from w w w . j a v a 2 s .com*/ try { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, new Boolean(true)); parser = factory.createXMLStreamReader(new StringReader(content)); } catch (XMLStreamException e) { String msg = "Error in initializing the parser to build the OMElement."; log.error(msg, e); throw new GovernanceException(msg, e); } //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); //get the root element (in this case the envelope) return builder.getDocumentElement(); }
From source file:org.wso2.carbon.governance.api.generic.GenericArtifactManager.java
/** * Creates a new artifact from the given string content. * * @param omContent the artifact content in string * * @return the artifact added.// w w w. j ava 2 s .c om * @throws GovernanceException if the operation failed. */ public GenericArtifact newGovernanceArtifact(String omContent) throws GovernanceException { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, true); try { XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(omContent)); GenericArtifact artifact = this.newGovernanceArtifact(new StAXOMBuilder(reader).getDocumentElement()); artifact.setContent(omContent.getBytes()); return artifact; } catch (XMLStreamException e) { String message = "Error in creating the content from the parameters."; log.error(message, e); throw new GovernanceException(message, e); } }
From source file:org.wso2.carbon.governance.api.util.GovernanceUtils.java
/** * Method to build an AXIOM element from a byte stream. * * @param content the stream of bytes.// w ww . java2s . c om * @return the AXIOM element. * @throws GovernanceException if the operation failed. */ public static OMElement buildOMElement(byte[] content) throws RegistryException { XMLStreamReader parser; try { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, new Boolean(true)); parser = factory.createXMLStreamReader(new StringReader(RegistryUtils.decodeBytes(content))); } catch (XMLStreamException e) { String msg = "Error in initializing the parser to build the OMElement."; log.error(msg, e); throw new GovernanceException(msg, e); } //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); //get the root element (in this case the envelope) return builder.getDocumentElement(); }
From source file:org.wso2.carbon.governance.generic.services.ManageGenericArtifactService.java
public String addArtifact(String key, String info, String lifecycleAttribute) throws RegistryException { RegistryUtils.recordStatistics(key, info, lifecycleAttribute); Registry registry = getGovernanceUserRegistry(); if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) { return null; }//from w w w .j a v a 2 s. c o m try { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, true); XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(info)); GenericArtifactManager manager = new GenericArtifactManager(registry, key); GenericArtifact artifact = manager .newGovernanceArtifact(new StAXOMBuilder(reader).getDocumentElement()); // want to save original content, so set content here artifact.setContent(info.getBytes()); artifact.setAttribute("resource.source", "AdminConsole"); manager.addGenericArtifact(artifact); if (lifecycleAttribute != null) { String lifecycle = artifact.getAttribute(lifecycleAttribute); if (lifecycle != null) { artifact.attachLifecycle(lifecycle); } } return RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + artifact.getPath(); } catch (Exception e) { String msg = "Unable to add artifact. "; if (e instanceof RegistryException) { throw (RegistryException) e; } else if (e instanceof OMException) { msg += "Unexpected character found in input-field name."; log.error(msg, e); throw new RegistryException(msg, e); } throw new RegistryException( msg + (e.getCause() instanceof SQLException ? "" : e.getCause().getMessage()), e); } }
From source file:org.wso2.carbon.governance.generic.services.ManageGenericArtifactService.java
public ArtifactsBean listArtifacts(String key, String criteria) { RegistryUtils.recordStatistics(key, criteria); UserRegistry governanceRegistry = (UserRegistry) getGovernanceUserRegistry(); ArtifactsBean bean = new ArtifactsBean(); try {/*from w ww .jav a 2s. co m*/ final GovernanceArtifactConfiguration configuration = loadAndFindGovernanceArtifactConfiguration(key, getRootRegistry()); GenericArtifactManager manager = new GenericArtifactManager(governanceRegistry, configuration.getMediaType(), configuration.getArtifactNameAttribute(), configuration.getArtifactNamespaceAttribute(), configuration.getArtifactElementRoot(), configuration.getArtifactElementNamespace(), configuration.getPathExpression(), configuration.getRelationshipDefinitions()); final GenericArtifact referenceArtifact; if (criteria != null) { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, true); XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(criteria)); referenceArtifact = manager.newGovernanceArtifact(new StAXOMBuilder(reader).getDocumentElement()); } else { referenceArtifact = null; } bean.setNames(configuration.getNamesOnListUI()); bean.setTypes(configuration.getTypesOnListUI()); bean.setKeys(configuration.getKeysOnListUI()); String[] expressions = configuration.getExpressionsOnListUI(); String[] keys = configuration.getKeysOnListUI(); List<GovernanceArtifact> artifacts = new LinkedList<GovernanceArtifact>(); artifacts.addAll( Arrays.asList(manager.findGenericArtifacts(getFieldsList(referenceArtifact, configuration)))); List<ArtifactBean> artifactBeans = new LinkedList<ArtifactBean>(); for (GovernanceArtifact artifact : artifacts) { int kk = 0; ArtifactBean artifactBean = new ArtifactBean(); List<String> paths = new ArrayList<String>(); List<String> values = new ArrayList<String>(); String path = RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + ((GenericArtifactImpl) artifact).getArtifactPath(); artifactBean.setPath(path); for (int i = 0; i < expressions.length; i++) { if (expressions[i] != null) { if (expressions[i].contains("@{storagePath}") && ((GenericArtifactImpl) artifact).getArtifactPath() != null) { paths.add(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + GovernanceUtils.getPathFromPathExpression(expressions[i], artifact, ((GenericArtifactImpl) artifact).getArtifactPath())); } else { if ("link".equals(bean.getTypes()[i])) { paths.add(GovernanceUtils.getPathFromPathExpression(expressions[i], artifact, configuration.getPathExpression())); } else { paths.add(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + GovernanceUtils.getPathFromPathExpression(expressions[i], artifact, configuration.getPathExpression())); } } } else { paths.add(""); } } artifactBean.setValuesB(paths.toArray(new String[paths.size()])); for (String keyForValue : keys) { if (keyForValue != null) { values.add(artifact.getAttribute(keyForValue)); } else { values.add(""); } } artifactBean.setValuesA(values.toArray(new String[values.size()])); artifactBean.setCanDelete(governanceRegistry.getUserRealm().getAuthorizationManager() .isUserAuthorized(governanceRegistry.getUserName(), path, ActionConstants.DELETE)); artifactBean.setLCName(((GenericArtifactImpl) artifact).getLcName()); artifactBean.setLCState(((GenericArtifactImpl) artifact).getLcState()); artifactBean.setCreatedDate(governanceRegistry .get(((GenericArtifactImpl) artifact).getArtifactPath()).getCreatedTime()); artifactBean.setLastUpdatedDate(governanceRegistry .get(((GenericArtifactImpl) artifact).getArtifactPath()).getLastModified()); artifactBean.setCreatedBy(governanceRegistry.get(((GenericArtifactImpl) artifact).getArtifactPath()) .getAuthorUserName()); artifactBean.setLastUpdatedBy(governanceRegistry .get(((GenericArtifactImpl) artifact).getArtifactPath()).getLastUpdaterUserName()); artifactBeans.add(artifactBean); } bean.setArtifacts(artifactBeans.toArray(new ArtifactBean[artifactBeans.size()])); } catch (RuntimeException e) { throw e; } catch (Exception e) { log.error("An error occurred while obtaining the list of artifacts.", e); } return bean; }
From source file:org.wso2.carbon.governance.generic.services.ManageGenericArtifactService.java
public String editArtifact(String path, String key, String info, String lifecycleAttribute) throws RegistryException { RegistryUtils.recordStatistics(path, key, info, lifecycleAttribute); Registry registry = getGovernanceUserRegistry(); if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) { return null; }/*ww w. ja v a 2 s. c o m*/ try { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, true); XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(info)); GovernanceArtifactConfiguration configuration = loadAndFindGovernanceArtifactConfiguration(key, getRootRegistry()); GenericArtifactManager manager = new GenericArtifactManager(registry, key); GenericArtifact artifact = manager .newGovernanceArtifact(new StAXOMBuilder(reader).getDocumentElement()); String currentPath; if (path != null && path.length() > 0) { currentPath = path.substring(RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH.length()); } else { currentPath = GovernanceUtils.getPathFromPathExpression(configuration.getPathExpression(), artifact); } if (registry.resourceExists(currentPath)) { GovernanceArtifact oldArtifact = GovernanceUtils.retrieveGovernanceArtifactByPath(registry, currentPath); if (!(oldArtifact instanceof GovernanceArtifact)) { String msg = "The updated path is occupied by a non-generic artifact. path: " + currentPath + "."; log.error(msg); throw new Exception(msg); } artifact.setId(oldArtifact.getId()); // want to save original content artifact.setContent(info.getBytes()); manager.updateGenericArtifact(artifact); } else { manager.addGenericArtifact(artifact); } if (lifecycleAttribute != null && !lifecycleAttribute.equals("null")) { String lifecycle = artifact.getAttribute(lifecycleAttribute); artifact.attachLifecycle(lifecycle); } return RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + artifact.getPath(); } catch (Exception e) { String msg = "Unable to edit artifact. "; if (e instanceof RegistryException) { throw (RegistryException) e; } else if (e instanceof OMException) { msg += "Unexpected character found in input-field name."; log.error(msg, e); throw new RegistryException(msg, e); } throw new RegistryException( msg + (e.getCause() instanceof SQLException ? "" : e.getCause().getMessage()), e); } }
From source file:org.wso2.carbon.governance.metadata.provider.util.Util.java
public static OMElement buildOMElement(byte[] content) throws MetadataException { XMLStreamReader parser;/*from www . j av a 2 s . co m*/ try { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, new Boolean(true)); parser = factory.createXMLStreamReader(new StringReader(RegistryUtils.decodeBytes(content))); } catch (Exception e) { String msg = "Error in initializing the parser to build the OMElement."; log.error(msg, e); throw new MetadataException("", e); } //create the builder StAXOMBuilder builder = new StAXOMBuilder(parser); //get the root element (in this case the envelope) return builder.getDocumentElement(); }
From source file:presentation.webgui.vitroappservlet.uploadService.UploadServlet.java
private void doFileUpload(HttpSession session, HttpServletRequest request, HttpServletResponse response) throws IOException { String fname = ""; HashMap<String, String> myFileRequestParamsHM = new HashMap<String, String>(); try {//from ww w. j av a 2 s . c om FileUploadListener listener = new FileUploadListener(request.getContentLength()); FileItemFactory factory = new MonitoredDiskFileItemFactory(listener); ServletFileUpload upload = new ServletFileUpload(factory); // upload.setSizeMax(83886080); /* the unit is bytes */ FileItem fileItem = null; fileItem = myrequestGetParameter(upload, request, myFileRequestParamsHM); String mode = myFileRequestParamsHM.get("mode"); session.setAttribute("FILE_UPLOAD_STATS" + mode, listener.getFileUploadStats()); boolean hasError = false; if (fileItem != null) { /** * (for KML only files) ( not prefabs (collada) or icons or images) */ WstxInputFactory f = null; XMLStreamReader2 sr = null; SMInputCursor iroot = null; if (mode.equals("3dFile") || mode.equals("LinePlaceMarksFile") || mode.equals("RoomCenterPointsFile")) { f = new WstxInputFactory(); f.configureForConvenience(); // Let's configure factory 'optimally'... f.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); f.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE); sr = (XMLStreamReader2) f.createXMLStreamReader(fileItem.getInputStream()); iroot = SMInputFactory.rootElementCursor(sr); // If we needed to store some information about preceding siblings, // we should enable tracking. (we need it for mygetElementValueStaxMultiple method) iroot.setElementTracking(SMInputCursor.Tracking.PARENTS); iroot.getNext(); if (!"kml".equals(iroot.getLocalName().toLowerCase())) { hasError = true; listener.getFileUploadStats().setCurrentStatus("finito"); session.setAttribute("FILE_UPLOAD_STATS" + mode, listener.getFileUploadStats()); sendCompleteResponse(myFileRequestParamsHM, response, hasError, "Root element not kml, as expected, but " + iroot.getLocalName()); return; } } fname = ""; if (mode.equals("3dFile")) { if ((fileItem.getSize() / 1024) > 25096) { // with woodstox stax, file size should not be a problem. Let's put some limit however! hasError = true; listener.getFileUploadStats().setCurrentStatus("finito"); session.setAttribute("FILE_UPLOAD_STATS" + mode, listener.getFileUploadStats()); sendCompleteResponse(myFileRequestParamsHM, response, hasError, "File is very large for XML handler to process!"); return; } fname = ""; String[] elementsToFollow = { "document", "name" }; Vector<String> resultValues = SMTools.mygetElementValueStax(iroot, elementsToFollow, 0); if (resultValues != null && !resultValues.isEmpty()) { fname = resultValues.elementAt(0); } if (!fname.equals("")) { // check for kml extension and Add it if necessary!! int lastdot = fname.lastIndexOf('.'); if (lastdot != -1) { if (lastdot == 0) // if it is the first char then ignore it and add an extension anyway { fname += ".kml"; } else if (lastdot < fname.length() - 1) { if (!(fname.substring(lastdot + 1).toLowerCase().equals("kml"))) { fname += ".kml"; } } else if (lastdot == fname.length() - 1) { fname += "kml"; } } else { fname += ".kml"; } String realPath = this.getServletContext().getRealPath("/"); int lastslash = realPath.lastIndexOf(File.separator); realPath = realPath.substring(0, lastslash); // too slow //FileWriter out = new FileWriter(realPath+File.separator+"KML"+File.separator+fname); //document.sendToWriter(out); // too slow //StringWriter outString = new StringWriter(); //document.sendToWriter(outString); //out.close(); // fast - do not process and store xml file, just store it. File outFile = new File(realPath + File.separator + "Models" + File.separator + "Large" + File.separator + fname); outFile.createNewFile(); FileWriter tmpoutWriter = new FileWriter(outFile); BufferedWriter buffWriter = new BufferedWriter(tmpoutWriter); buffWriter.write(new String(fileItem.get())); buffWriter.flush(); buffWriter.close(); tmpoutWriter.close(); } else { hasError = true; listener.getFileUploadStats().setCurrentStatus("finito"); session.setAttribute("FILE_UPLOAD_STATS" + mode, listener.getFileUploadStats()); sendCompleteResponse(myFileRequestParamsHM, response, hasError, "No name tag found inside the KML file!"); return; } } else if (mode.equals("LinePlaceMarksFile")) { fname = ""; String[] elementsToFollow = { "document", "folder", "placemark", "point", "coordinates" }; Vector<String> resultValues = SMTools.mygetElementValueStax(iroot, elementsToFollow, 0); if (resultValues != null && resultValues.size() < 2) { hasError = true; listener.getFileUploadStats().setCurrentStatus("finito"); session.setAttribute("FILE_UPLOAD_STATS" + mode, listener.getFileUploadStats()); sendCompleteResponse(myFileRequestParamsHM, response, hasError, "File does not contain 2 placemarks!"); return; } for (int i = 0; (i < resultValues.size()) && (i < 2); i++) { fname = fname + ":" + resultValues.elementAt(i); } } else if (mode.equals("RoomCenterPointsFile")) { fname = ""; // here: process PlaceMarks for rooms (centerpoints) in the building String[] elementsToFollow0 = { "document", "folder", "placemark", "point", "coordinates" }; String[] elementsToFollow1 = { "document", "folder", "placemark", "name" }; // add elements to follow for room names and coordinates Vector<String[]> elementsToFollow = new Vector<String[]>(); elementsToFollow.add(elementsToFollow0); elementsToFollow.add(elementsToFollow1); Vector<Vector<String>> resultValues = new Vector<Vector<String>>(); SMTools.mygetMultipleElementValuesStax(iroot, elementsToFollow, resultValues); Vector<String> resultValuesForCoords = resultValues.elementAt(0); Vector<String> resultValuesForNames = resultValues.elementAt(1); if (resultValuesForCoords == null || resultValuesForCoords.size() == 0 || resultValuesForNames == null || resultValuesForCoords.size() == 0 || resultValuesForCoords.size() != resultValuesForNames.size()) { hasError = true; listener.getFileUploadStats().setCurrentStatus("finito"); session.setAttribute("FILE_UPLOAD_STATS" + mode, listener.getFileUploadStats()); sendCompleteResponse(myFileRequestParamsHM, response, hasError, "File does not contain valid data for rooms!"); return; } for (int i = 0; i < resultValuesForNames.size(); i++) { // since we use ; and ':' to seperate rooms, we replace the comma's in the rooms' names. if (resultValuesForNames.elementAt(i).indexOf(';') >= 0 || resultValuesForNames.elementAt(i).indexOf(':') >= 0) { String tmp = new String(resultValuesForNames.elementAt(i)); tmp.replace(';', ' '); tmp.replace(':', ' '); resultValuesForNames.set(i, tmp); } fname = fname + ";" + resultValuesForNames.elementAt(i) + ":" + resultValuesForCoords.elementAt(i); } } else if (mode.equals("DefaultIconfile") || mode.equals("DefaultPrefabfile") || mode.equals("SpecialValueIconfile") || mode.equals("SpecialValuePrefabfile") || mode.equals("NumericRangeIconfile") || mode.equals("NumericRangePrefabfile")) { fname = ""; if ((fileItem.getSize() / 1024) > 10096) { // no more than 10 Mbs of size for small prefabs or icons hasError = true; listener.getFileUploadStats().setCurrentStatus("finito"); session.setAttribute("FILE_UPLOAD_STATS" + mode, listener.getFileUploadStats()); sendCompleteResponse(myFileRequestParamsHM, response, hasError, "File is very large!"); return; } fname = fileItem.getName(); if (!fname.equals("")) { String realPath = this.getServletContext().getRealPath("/"); int lastslash = realPath.lastIndexOf(File.separator); realPath = realPath.substring(0, lastslash); File outFile = new File(realPath + File.separator + "Models" + File.separator + "Media" + File.separator + fname); outFile.createNewFile(); /* FileWriter tmpoutWriter = new FileWriter(outFile); BufferedWriter buffWriter = new BufferedWriter(tmpoutWriter); buffWriter.write(new String(fileItem.get())); buffWriter.flush(); buffWriter.close(); tmpoutWriter.close(); */ fileItem.write(outFile); } else { hasError = true; listener.getFileUploadStats().setCurrentStatus("finito"); session.setAttribute("FILE_UPLOAD_STATS" + mode, listener.getFileUploadStats()); sendCompleteResponse(myFileRequestParamsHM, response, hasError, "No valid name for uploaded file!"); return; } } fileItem.delete(); } if (!hasError) { sendCompleteResponse(myFileRequestParamsHM, response, hasError, fname); } else { hasError = true; sendCompleteResponse(myFileRequestParamsHM, response, hasError, "Could not process uploaded file. Please see log for details."); } } catch (Exception e) { boolean hasError = true; sendCompleteResponse(myFileRequestParamsHM, response, hasError, "::" + fname + "::" + e.getMessage()); } }
From source file:source.YahooAnswersStreamParser.java
public YahooAnswersStreamParser(String fileName, boolean bDoCleanUp) throws IOException, XMLStreamException { mFile = new File(fileName); mDoCleanUp = bDoCleanUp;//from w ww. ja v a 2s . co m final XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, true); InputStream is = CompressUtils.createInputStream(fileName); mReader = factory.createXMLStreamReader(new InvalidXmlCharFilter(new InputStreamReader(is, "UTF-8"))); mNextDoc = fetchNext(); }
From source file:uk.ac.ebi.metabolomes.webservices.eutils.ESummaryXMLResponseParser.java
/** * Parses the whole ESummaryResult XML object, delivering a List of ESummaryResults. * /*from w w w. j a v a2s .c o m*/ * @param in the input stream through which the response the response can be read. * @return multimap with the mappings from the XML. * @throws javax.xml.stream.XMLStreamException */ public List<T> parseESummaryResult(InputStream in) throws XMLStreamException { XMLInputFactory2 xmlif = (XMLInputFactory2) XMLInputFactory2.newInstance(); xmlif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE); xmlif.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.TRUE); xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); xmlif.configureForSpeed(); XMLStreamReader2 xmlr = (XMLStreamReader2) xmlif.createXMLStreamReader(in); int event; List<T> results = new ArrayList<T>(); T currentResult = getNewESummaryResult(); while (xmlr.hasNext()) { event = xmlr.next(); switch1: switch (event) { case XMLEvent.START_DOCUMENT: break; case XMLEvent.START_ELEMENT: //LOGGER.info("Start Element: "+xmlr.getLocalName()); //LOGGER.info("Attributes: "+getAttributes(xmlr)); if (xmlr.getLocalName().equalsIgnoreCase("Item")) { boolean done = false; for (Enum keyword : currentResult.getScalarKeywords()) { if (hasAttributeNameWithValue(xmlr, keyword.toString())) { //LOGGER.info("Entering addScalarForKeyword: "+keyword.toString()+" for "+xmlr.getLocalName()); currentResult.addScalarForKeyword(keyword, getFollowingCharacters(xmlr)); break switch1; } } for (Enum keyword : currentResult.getListKeywords()) { if (hasAttributeNameWithValue(xmlr, keyword.toString())) { //LOGGER.info("Entering addListForKeyword: "+keyword.toString()+" for "+xmlr.getLocalName()); currentResult.addListForKeyword(keyword, parseList(xmlr)); break switch1; } } } if (xmlr.getLocalName().equalsIgnoreCase("Id")) { for (Enum keyword : currentResult.getScalarKeywords()) { if (keyword.toString().equalsIgnoreCase("Id")) { currentResult.addScalarForKeyword(keyword, getFollowingCharacters(xmlr)); break switch1; } } } /* if (xmlr.getLocalName().equalsIgnoreCase("Item") && hasAttributeNameWithValue(xmlr, "SID")) { currentResult.setId(getFollowingCharacters(xmlr)); } else if (xmlr.getLocalName().equalsIgnoreCase("Item") && hasAttributeNameWithValue(xmlr, "SourceNameList")) { currentResult.setSourceNames(parseList(xmlr)); } else if (xmlr.getLocalName().equalsIgnoreCase("Item") && hasAttributeNameWithValue(xmlr, "SourceID")) { currentResult.addSourceID(getFollowingCharacters(xmlr)); } else if (xmlr.getLocalName().equalsIgnoreCase("Item") && hasAttributeNameWithValue(xmlr, "DBUrl")) { currentResult.setDBUrl(getFollowingCharacters(xmlr)); } else if (xmlr.getLocalName().equalsIgnoreCase("Item") && hasAttributeNameWithValue(xmlr, "SynonymList")) { currentResult.setSynonyms(parseList(xmlr)); }*/ break; case XMLEvent.END_ELEMENT: //LOGGER.info("End Element: "+xmlr.getLocalName()); if (xmlr.getLocalName().equalsIgnoreCase("DocSum")) { currentResult.wrap(); results.add(currentResult); currentResult = getNewESummaryResult(); } break; } } xmlr.closeCompletely(); return results; }