public List operate(Object node) { if (node instanceof Element) return((Element) node).getContent(); else if (node instanceof Document) return((Document) node).getContent(); // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_content can not be applied on " + node.getClass()); } }
public List cloneContent() { int size = getContentSize(); List list = new ArrayList(size); for (int i = 0; i < size; i++) { Content child = getContent(i); list.add(child.clone()); } return list; }
@Override void getContent(Object node, List result) { if (node instanceof Element) result.addAll(((Element) node).getContent()); else if (node instanceof Document) result.addAll(((Document) node).getContent()); }
public Iterator getChildAxisIterator(Object contextNode) { if ( contextNode instanceof Element ) { return ((Element)contextNode).getContent().iterator(); } else if ( contextNode instanceof Document ) { return ((Document)contextNode).getContent().iterator(); } return JaxenConstants.EMPTY_ITERATOR; }
public void writeDocument(Document doc, XMLStreamWriter writer) throws XMLStreamException { writer.writeStartDocument("1.0"); for (Iterator<?> itr = doc.getContent().iterator(); itr.hasNext();) { Content content = (Content)itr.next(); if (content instanceof Element) { writeElement((Element)content, writer); } } writer.writeEndDocument(); }
public List operate(Object node) { if (node instanceof Element) return((Element)node).getContent(); else if (node instanceof Document) return((Document)node).getContent(); // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_content can not be applied on " + node.getClass()); } }
public List operate(Object node) { if (node instanceof Element) return((Element) node).getContent(); else if (node instanceof Document) return((Document) node).getContent(); // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_content can not be applied on " + node.getClass()); } }
public boolean isLeaf() { if (node instanceof Element) { return ((Element) node).getContent().size() == 0; } if (node instanceof Document) { return ((Document) node).getContent().size() == 0; } return true; }
public void writeDocument(Document doc, XMLStreamWriter writer) throws XMLStreamException { writer.writeStartDocument("1.0"); for (Iterator itr = doc.getContent().iterator(); itr.hasNext();) { Content content = (Content) itr.next(); if (content instanceof Element) writeElement((Element) content, writer); } writer.writeEndDocument(); }
public List operate(Object node) { if (node instanceof Element) return((Element) node).getContent(); else if (node instanceof Document) return((Document) node).getContent(); // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_content can not be applied on " + node.getClass()); } }
private void removeTestCorefAnnotations (Document doc) { List children = doc.getContent(); Iterator childIterator = children.iterator(); while (childIterator.hasNext()) { Object o = childIterator.next(); if (o instanceof Element) { removeTestCorefAnnotations ((Element) o); } } }
public void writeDocument(Document doc, XMLStreamWriter writer) throws XMLStreamException { writer.writeStartDocument("1.0"); for (Iterator<?> itr = doc.getContent().iterator(); itr.hasNext();) { Content content = (Content)itr.next(); if (content instanceof Element) { writeElement((Element)content, writer); } } writer.writeEndDocument(); }
void getContent(Object node, List result) { if (node instanceof Element) result.addAll(((Element)node).getContent()); else if (node instanceof Document) result.addAll(((Document)node).getContent()); }
@Override void getContent(Object node, List result) { if (node instanceof Element) result.addAll(((Element) node).getContent()); else if (node instanceof Document) result.addAll(((Document) node).getContent()); }
@Override void getContent(Object node, List result) { if (node instanceof Element) result.addAll(((Element) node).getContent()); else if (node instanceof Document) result.addAll(((Document) node).getContent()); }
private static void removeComments(Document doc) { removeComments(doc.getContent()); }
private static void removeComments(Document doc) { removeComments(doc.getContent()); }
@RequestMapping(value="/displayProcessFile/{processInstanceId}", method=RequestMethod.GET) public ResponseEntity<byte[]> displayProcessFile(@PathVariable String processInstanceId) throws UnauthorizedUserAccessException{ Document processFile=null; try { processFile = documentService.retrieveProcessFile(Long.parseLong(processInstanceId)); } catch (ProcessFileNotFoundExpection e) { e.printStackTrace(); } HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.parseMediaType("application/pdf")); headers.add("content-disposition", "attachment;filename=" + processFile.getDocName()); ResponseEntity<byte[]> response = new ResponseEntity<byte[]>(processFile.getContent(), headers, HttpStatus.OK); return response; }
@RequestMapping(value="/displayProcessFile/{processInstanceId}", method=RequestMethod.GET) public ResponseEntity<byte[]> displayProcessFile(@PathVariable String processInstanceId) throws UnauthorizedUserAccessException{ Document processFile=null; try { processFile = documentService.retrieveProcessFile(Long.parseLong(processInstanceId)); } catch (ProcessFileNotFoundExpection e) { e.printStackTrace(); } HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.parseMediaType("application/pdf")); headers.add("content-disposition", "inline;filename=" + processFile.getDocName()); ResponseEntity<byte[]> response = new ResponseEntity<byte[]>(processFile.getContent(), headers, HttpStatus.OK); return response; }
/** * Get relative position of this among all siblings. * @return 1..n */ private int getRelativePositionOfElement() { Object parent = ((Element) node).getParent(); if (parent == null) { return 1; } List children; if (parent instanceof Element) { children = ((Element) parent).getContent(); } else { children = ((Document) parent).getContent(); } int count = 0; for (int i = 0; i < children.size(); i++) { Object child = children.get(i); if (child instanceof Element) { count++; } if (child == node) { break; } } return count; }