@Override protected boolean continueProcessing(XmlMetadata meta) { if (meta.getParsedDocument() == null) { LOG.warn("Skipping XPathClassifyingDecorator; no parsed doc: " + meta.getFilePointer().getAbsolutePath()); return false; } try { final Boolean nodes = (Boolean) expression.evaluate(meta.getParsedDocument(), XPathConstants.BOOLEAN); if (nodes != null) { if (LOG.isDebugEnabled()) { LOG.debug("Returning: " + nodes.booleanValue() + " for XPath: " + xpathExpression + " on file: " + meta.getFilePointer().getAbsolutePath()); } return nodes.booleanValue(); } } catch (Exception e) { LOG.error("Exception running xpath.", e); } return false; } }
Node node = (Node) xpath.evaluate(xpathExp, file.getParsedDocument(), XPathConstants.NODE);
@Override public void processMeta(XmlMetadata fileMeta) { Document document = fileMeta.getParsedDocument(); if (document == null) { if (LOG.isDebugEnabled()) { LOG.debug("Document was null. Problem parsing: " + fileMeta.getFilePointer().getAbsolutePath()); } // attach the bad file so we see it in the reports... fileMeta.getArchiveMeta().getEntries().add(fileMeta); return; } super.processMeta(fileMeta); }
@Override public void processMeta(final XmlMetadata meta) { if (meta.getParsedDocument() == null) { LOG.warn("Skipping XPathClassifyingDecorator: " + meta.getFilePointer().getAbsolutePath() + " because the document is unparsed."); return; Document doc = meta.getParsedDocument(); if (doc == null) { throw new NullPointerException();
@Override public void processMeta(final XmlMetadata meta) { if (meta.getParsedDocument() == null) { LOG.warn("Skipping XPathClassifyingDecorator: " + meta.getFilePointer().getAbsolutePath() + " because the document is unparsed."); return; Document doc = meta.getParsedDocument(); if (doc == null) { throw new NullPointerException();
boolean isProcessed = false; if (meta.getParsedDocument() == null) { LOG.warn("Skipping XPathClassifyingDecorator: " + meta.getFilePointer().getAbsolutePath() + Document doc = meta.getParsedDocument(); if (doc == null) { throw new NullPointerException();
@Override public void processMeta(XmlMetadata file) { String relativeDirectory = StringUtils.substringBeforeLast(file.getFilePointer().getAbsolutePath(), File.separator); String fileName = StringUtils.substringAfterLast(file.getFilePointer().getAbsolutePath(), File.separator); fileName = StringUtils.replace(fileName, ".", "-"); fileName = fileName + outputExtension; File relativeFile = new File(relativeDirectory + File.separator + fileName); Source xmlSource = new DOMSource(file.getParsedDocument()); Result xmlResult = new StreamResult(relativeFile); try { xsltTransformer.transform(xmlSource, xmlResult); Link linkResult = new Link(); linkResult.setDescription(outputDescription); linkResult.setLink(fileName); linkResult.setEffort(effort); if (LOG.isDebugEnabled()) { LOG.debug("Created link: " + ReflectionToStringBuilder.toString(linkResult)); } file.getDecorations().add(linkResult); } catch (TransformerException e) { LOG.error("Exception transforming XML.", e); } }
@Override public void processMeta(XmlMetadata file) { Document doc = file.getParsedDocument(); try { String description = extractStringValue(xPath, doc); if (StringUtils.isNotBlank(description)) { Summary result = new Summary(); result.setDescription(description); // add the link to the archive. file.getArchiveMeta().getDecorations().add(result); } } catch (XPathExpressionException e) { LOG.error("Exception running xpath expression.", e); } }
@Override public void processMeta(XmlMetadata file) { Document doc = file.getParsedDocument(); try { String link = extractStringValue(linkXPath, doc); if (StringUtils.isNotBlank(link)) { Link result = new Link(); result.setLink(link); result.setDescription("Project Site"); // add the link to the archive. file.getArchiveMeta().getDecorations().add(result); } } catch (XPathExpressionException e) { LOG.error("Exception running xpath expression.", e); } }
Document doc = file.getParsedDocument(); try { String groupId = extractStringValue(groupIdXPath, doc);
@Override public void processMeta(XmlMetadata file) { Doctype docType = (Doctype) file.getParsedDocument().getUserData(LocationAwareContentHandler.DOCTYPE_KEY_NAME); if (docType != null && matchesAny(docType)) { Classification cr = new Classification(); cr.setDescription(matchDescription); cr.setEffort(effort); file.getDecorations().add(cr); // if it is of a certain type, recurse to the child processors chainDecorators(file); } }
Document doc = meta.getParsedDocument(); if (doc == null) { throw new NullPointerException();