/** * Replaces the content of a tag. * @param namespaceURI the URI of the namespace * @param localName the tag name * @param value the new content for the tag * @return true if the content was successfully replaced * @since 2.1.6 the return type has changed from void to boolean */ public boolean replace(String namespaceURI, String localName, String value) { NodeList nodes = domDocument.getElementsByTagNameNS(namespaceURI, localName); Node node; if (nodes.getLength() == 0) return false; for (int i = 0; i < nodes.getLength(); i++) { node = nodes.item(i); setNodeText(domDocument, node, value); } return true; }
PdfStream xmp; try { XmpReader xmpr = new XmpReader(altMetadata); if (!xmpr.replace("http://ns.adobe.com/pdf/1.3/", "Producer", producer)) xmpr.add("rdf:Description", "http://ns.adobe.com/pdf/1.3/", "pdf:Producer", producer); if (!xmpr.replace("http://ns.adobe.com/xap/1.0/", "ModifyDate", date.getW3CDate())) xmpr.add("rdf:Description", "http://ns.adobe.com/xap/1.0/", "xmp:ModifyDate", date.getW3CDate()); xmpr.replace("http://ns.adobe.com/xap/1.0/", "MetadataDate", date.getW3CDate()); xmp = new PdfStream(xmpr.serializeDoc());
PdfStream xmp; try { XmpReader xmpr = new XmpReader(altMetadata); if (!xmpr.replace("http://ns.adobe.com/pdf/1.3/", "Producer", producer)) xmpr.add("rdf:Description", "http://ns.adobe.com/pdf/1.3/", "pdf:Producer", producer); if (!xmpr.replace("http://ns.adobe.com/xap/1.0/", "ModifyDate", date.getW3CDate())) xmpr.add("rdf:Description", "http://ns.adobe.com/xap/1.0/", "xmp:ModifyDate", date.getW3CDate()); xmpr.replace("http://ns.adobe.com/xap/1.0/", "MetadataDate", date.getW3CDate()); xmp = new PdfStream(xmpr.serializeDoc());
PdfStream xmp; try { XmpReader xmpr = new XmpReader(altMetadata); if (!xmpr.replace("http://ns.adobe.com/pdf/1.3/", "Producer", producer)) xmpr.add("rdf:Description", "http://ns.adobe.com/pdf/1.3/", "pdf:Producer", producer); if (!xmpr.replace("http://ns.adobe.com/xap/1.0/", "ModifyDate", date.getW3CDate())) xmpr.add("rdf:Description", "http://ns.adobe.com/xap/1.0/", "xmp:ModifyDate", date.getW3CDate()); xmpr.replace("http://ns.adobe.com/xap/1.0/", "MetadataDate", date.getW3CDate()); xmp = new PdfStream(xmpr.serializeDoc());
/** * Replaces the content of a tag. * @param namespaceURI the URI of the namespace * @param localName the tag name * @param value the new content for the tag * @return true if the content was successfully replaced * @since 2.1.6 the return type has changed from void to boolean */ public boolean replace(String namespaceURI, String localName, String value) { NodeList nodes = domDocument.getElementsByTagNameNS(namespaceURI, localName); Node node; if (nodes.getLength() == 0) return false; for (int i = 0; i < nodes.getLength(); i++) { node = nodes.item(i); setNodeText(domDocument, node, value); } return true; }
/** * Replaces the content of a tag. * @param namespaceURI the URI of the namespace * @param localName the tag name * @param value the new content for the tag * @return true if the content was successfully replaced * @since 2.1.6 the return type has changed from void to boolean */ public boolean replace(String namespaceURI, String localName, String value) { NodeList nodes = domDocument.getElementsByTagNameNS(namespaceURI, localName); Node node; if (nodes.getLength() == 0) return false; for (int i = 0; i < nodes.getLength(); i++) { node = nodes.item(i); setNodeText(domDocument, node, value); } return true; }