public void saveJaxbXmlPart(JaxbXmlPart part) throws Docx4JException { if (part.getPartName().getName().equals("_rels/.rels")) { targetName = part.getPartName().getName(); } else { targetName = part.getPartName().getName().substring(1); log.debug("marshalling " + part.getPartName() ); part.marshal( fos ); fos.close(); throw new Docx4JException("part store has changed, and sourcePartStore not set"); } else { InputStream is = sourcePartStore.loadPart(part.getPartName().getName().substring(1)); FileOutputStream fos = new FileOutputStream(file); throw new Docx4JException("Error marshalling JaxbXmlPart " + part.getPartName(), e);
public void scramble(JaxbXmlPart p) { log.info("\n\n Scrambling " + p.getPartName().getName()); new TraversalUtil(p.getJaxbElement(), latinizer); }
public void detectDmlVml(JaxbXmlPart p) { log.info("\n\n Inspecting " + p.getPartName().getName()); dmlVmlAnalyzer.reinit(); dmlVmlAnalyzer.setPart(p); new TraversalUtil(p.getJaxbElement(), dmlVmlAnalyzer); result.unsafeObjectsByPart.put(p, dmlVmlAnalyzer.unsafeObjects); if (dmlVmlAnalyzer.unsafeObjects.size()>0){ result.anyUnsafeObjects = true; } result.inventoryObjectsByPart.put(p, dmlVmlAnalyzer.inventoryObjects); if (!result.containsVML) { result.containsVML = dmlVmlAnalyzer.containsVML; } result.fieldsPresent = this.dmlVmlAnalyzer.fieldsPresent; }
public void saveJaxbXmlPart(JaxbXmlPart part) throws Docx4JException { if (part.getPartName().getName().equals("_rels/.rels")) { targetName = part.getPartName().getName(); } else { targetName = part.getPartName().getName().substring(1); log.debug("marshalling " + part.getPartName() ); part.marshal( zos ); } else { log.debug(part.getPartName() + " is clean" ); ByteArray bytes = partByteArrays.get( part.getPartName().getName().substring(1) ); if (bytes == null) throw new IOException("part '" + part.getPartName() + "' not found"); zos.write( bytes.getBytes() ); InputStream is = sourcePartStore.loadPart(part.getPartName().getName().substring(1)); int read = 0; byte[] bytes = new byte[1024]; throw new Docx4JException("Error marshalling JaxbXmlPart " + part.getPartName(), e);
public void update(boolean processHeadersAndFooters) throws Docx4JException { report = new StringBuilder(); updatePart(wordMLPackage.getMainDocumentPart() ); if (processHeadersAndFooters) { RelationshipsPart rp = wordMLPackage.getMainDocumentPart().getRelationshipsPart(); for ( Relationship r : rp.getJaxbElement().getRelationship() ) { if (r.getType().equals(Namespaces.HEADER) || r.getType().equals(Namespaces.FOOTER)) { JaxbXmlPart part = (JaxbXmlPart)rp.getPart(r); report.append("\n" + part.getPartName() + "\n"); log.debug("\n" + part.getPartName() + "\n"); updatePart(part ); // performOnInstance( // ((ContentAccessor)part).getContent() ); } } } log.info(report.toString()); }
String name = this.getPartName().getName(); InputStream is = partStore.loadPart( name.substring(1)); ByteArray byteArray = ((ZipPartStore)partStore).getByteArray(this.getPartName().getName().substring(1)); byteArray.setBytes(saxHandler.getOutputStream().toByteArray());
/** * Workaround for the fact that Xalan doesn't let us pass an AtomicInteger into an extension * function. Instead, it converts it into an int, which means the object in our * bookmarkIdCounter parameter isn't updated. * * So here we wrap the AtomicInteger in a class, * * @author jharrop * */ public static class BookmarkCounter { protected AtomicInteger bookmarkId; BookmarkCounter(AtomicInteger bookmarkId) { this.bookmarkId = bookmarkId; } }
if (partStore==null) { log.info("No PartStore defined for this package (it was probably created, not loaded). " ); log.info(this.getPartName().getName() + ": did you initialise its contents to something?"); return null; String name = this.getPartName().getName(); throw new PartTooLargeException(this.getPartName() + ", length " + this.getContentLengthAsLoaded() + " exceeds your configured maximum allowed size for unmarshal."); throw new Docx4JException("Problem with part " + this.getPartName(), e);
public boolean isContentEqual(Part other) throws Docx4JException { log.debug("Comparing " + getPartName().getName() + " : " + other.getPartName().getName() );
@Override public PartName getPartName() { // Calculate rels part name dynamically where possible; // this ensures it is named appropriately // if its source part's name changes // (eg AddPartBehaviour.RENAME_IF_NAME_EXISTS) if (this.getSourceP()!=null && (!(this.getSourceP() instanceof OpcPackage))) { try { return new PartName(PartName.getRelationshipsPartName( sourceP.getPartName().getName() )); } catch (InvalidFormatException e) { throw new RuntimeException(e); } } else { return super.getPartName(); } }
private void process(JaxbXmlPart part) throws Docx4JException { log.info("/n Processing " + part.getPartName().getName() );
private void process(JaxbXmlPart part) throws Docx4JException { log.info("/n Processing " + part.getPartName().getName() );
String name = this.getPartName().getName(); InputStream is = partStore.loadPart( name.substring(1));
String name = this.getPartName().getName(); InputStream is = partStore.loadPart( name.substring(1)); String name = this.getPartName().getName(); is = partStore.loadPart( name.substring(1)); ByteArray byteArray = ((ZipPartStore)partStore).getByteArray(this.getPartName().getName().substring(1)); byteArray.setBytes(baos.toByteArray());
new TraversalUtil(contentList, fl); report.append("\n\nSimple Fields in " + part.getPartName() + "\n"); report.append("============= \n"); report.append("Found " + fl.simpleFields.size() + " simple fields \n ");
new TraversalUtil(contentList, fl); report.append("\n Complex Fields in "+ part.getPartName() + "\n"); report.append("============== \n");
log.debug( sourcePart.getPartName().getName() + "\n" + XmlUtils.marshaltoString(o, true, true, Context.jc, "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "anchor", o.getClass()));
String name = this.getPartName().getName(); InputStream is = partStore.loadPart( name.substring(1));
log.debug("\n\n BEFORE " + part.getPartName().getName() + "\n\n" + XmlUtils.marshaltoString(part.getJaxbElement(), true, true) + "\n"); log.debug("\n\n COMPLEXIFIED " + part.getPartName().getName() + "\n\n" + XmlUtils.marshaltoString(part.getJaxbElement(), true, true) + "\n"); log.debug("\n\n AFTER " + part.getPartName().getName() + "\n\n" + XmlUtils.marshaltoString(part.getJaxbElement(), true, true) + "\n");
public void scramble(JaxbXmlPart p) { log.info("\n\n Scrambling " + p.getPartName().getName()); new TraversalUtil(p.getJaxbElement(), latinizer); }