Package org.apache.xmlgraphics.xmp

Examples of org.apache.xmlgraphics.xmp.XMPProperty


public class ParseMetadata {

    private static void parseMetadata() throws TransformerException, SAXException {
        URL url = ParseMetadata.class.getResource("pdf-example.xmp");
        Metadata meta = XMPParser.parseXMP(url);
        XMPProperty prop;
        prop = meta.getProperty(XMPConstants.DUBLIN_CORE_NAMESPACE, "creator");
        XMPArray array;
        array = prop.getArrayValue();
        for (int i = 0, c = array.getSize(); i < c; i++) {
            System.out.println("Creator: " + array.getValue(i));
        }
        prop = meta.getProperty(XMPConstants.DUBLIN_CORE_NAMESPACE, "title");
        System.out.println("Title: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreateDate");
        System.out.println("Creation Date: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreatorTool");
        System.out.println("Creator Tool: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "Producer");
        System.out.println("Producer: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "PDFVersion");
        System.out.println("PDF version: " + prop.getValue());
       
        StreamResult res = new StreamResult(System.out);
        XMPSerializer.writeXML(meta, res);
    }
View Full Code Here


        dc.addDate(new Date());
       
        meta2.mergeInto(meta1);
       
        Metadata meta = meta1;
        XMPProperty prop;
        dc = new DublinCoreAdapter(meta);
        String[] creators = dc.getCreators();
        for (int i = 0, c = creators.length; i < c; i++) {
            System.out.println("Creator: " + creators[i]);
        }
        System.out.println("Title: " + dc.getTitle());
        System.out.println("Title de: " + dc.getTitle("de"));
        System.out.println("Title en: " + dc.getTitle("en"));
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreateDate");
        System.out.println("Creation Date: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreatorTool");
        System.out.println("Creator Tool: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "Producer");
        System.out.println("Producer: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "PDFVersion");
        System.out.println("PDF version: " + prop.getValue());
       
        XMPSerializer.writeXMPPacket(meta, System.out, false);
    }
View Full Code Here

public class ParseMetadata {

    private static void parseMetadata() throws TransformerException, SAXException {
        URL url = ParseMetadata.class.getResource("pdf-example.xmp");
        Metadata meta = XMPParser.parseXMP(url);
        XMPProperty prop;
        prop = meta.getProperty(XMPConstants.DUBLIN_CORE_NAMESPACE, "creator");
        XMPArray array;
        array = prop.getArrayValue();
        for (int i = 0, c = array.getSize(); i < c; i++) {
            System.out.println("Creator: " + array.getValue(i));
        }
        prop = meta.getProperty(XMPConstants.DUBLIN_CORE_NAMESPACE, "title");
        array = prop.getArrayValue();
        System.out.println("Default Title: " + array.getSimpleValue());
        System.out.println("German Title: " + array.getLangValue("de"));
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreateDate");
        System.out.println("Creation Date: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreatorTool");
        System.out.println("Creator Tool: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "Producer");
        System.out.println("Producer: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "PDFVersion");
        System.out.println("PDF version: " + prop.getValue());
       
        DublinCoreAdapter dc = DublinCoreSchema.getAdapter(meta);
        System.out.println("Default title: " + dc.getTitle());
        System.out.println("German title: " + dc.getTitle("de"));
       
View Full Code Here

    /**
     * @see org.apache.xmlgraphics.xmp.merge.PropertyMerger#merge(
     *          org.apache.xmlgraphics.xmp.XMPProperty, org.apache.xmlgraphics.xmp.Metadata)
     */
    public void merge(XMPProperty sourceProp, Metadata target) {
        XMPProperty prop = target.getProperty(sourceProp.getName());
        if (prop == null) {
            target.setProperty(sourceProp);
        }
    }
View Full Code Here

    /**
     * @see org.apache.xmlgraphics.xmp.merge.PropertyMerger#merge(
     *          org.apache.xmlgraphics.xmp.XMPProperty, org.apache.xmlgraphics.xmp.Metadata)
     */
    public void merge(XMPProperty sourceProp, Metadata target) {
        XMPProperty existing = target.getProperty(sourceProp.getName());
        if (existing == null) {
            //simply copy over
            target.setProperty(sourceProp);
        } else {
            existing.convertSimpleValueToArray(XMPArrayType.SEQ);
            XMPArray array = existing.getArrayValue();
            XMPArray otherArray = sourceProp.getArrayValue();
            if (otherArray == null) {
                if (sourceProp.getXMLLang() != null) {
                    array.add(sourceProp.getValue().toString(), sourceProp.getXMLLang());
                } else {
View Full Code Here

public class ParseMetadata {

    private static void parseMetadata() throws TransformerException, SAXException {
        URL url = ParseMetadata.class.getResource("pdf-example.xmp");
        Metadata meta = XMPParser.parseXMP(url);
        XMPProperty prop;
        prop = meta.getProperty(XMPConstants.DUBLIN_CORE_NAMESPACE, "creator");
        XMPArray array;
        array = prop.getArrayValue();
        for (int i = 0, c = array.getSize(); i < c; i++) {
            System.out.println("Creator: " + array.getValue(i));
        }
        prop = meta.getProperty(XMPConstants.DUBLIN_CORE_NAMESPACE, "title");
        array = prop.getArrayValue();
        System.out.println("Default Title: " + array.getSimpleValue());
        System.out.println("German Title: " + array.getLangValue("de"));
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreateDate");
        System.out.println("Creation Date: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreatorTool");
        System.out.println("Creator Tool: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "Producer");
        System.out.println("Producer: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "PDFVersion");
        System.out.println("PDF version: " + prop.getValue());

        DublinCoreAdapter dc = DublinCoreSchema.getAdapter(meta);
        System.out.println("Default title: " + dc.getTitle());
        System.out.println("German title: " + dc.getTitle("de"));
View Full Code Here

        dc.addDate(new Date());

        meta2.mergeInto(meta1);

        Metadata meta = meta1;
        XMPProperty prop;
        dc = new DublinCoreAdapter(meta);
        String[] creators = dc.getCreators();
        for (int i = 0, c = creators.length; i < c; i++) {
            System.out.println("Creator: " + creators[i]);
        }
        System.out.println("Title: " + dc.getTitle());
        System.out.println("Title de: " + dc.getTitle("de"));
        System.out.println("Title en: " + dc.getTitle("en"));
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreateDate");
        System.out.println("Creation Date: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreatorTool");
        System.out.println("Creator Tool: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "Producer");
        System.out.println("Producer: " + prop.getValue());
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "PDFVersion");
        System.out.println("PDF version: " + prop.getValue());

        XMPSerializer.writeXMPPacket(meta, System.out, false);
    }
View Full Code Here

            in.close();
        }
    }

    private static void dumpSomeMetadata(Metadata meta) {
        XMPProperty prop;
        prop = meta.getProperty(XMPConstants.DUBLIN_CORE_NAMESPACE, "creator");
        if (prop != null) {
            XMPArray array;
            array = prop.getArrayValue();
            for (int i = 0, c = array.getSize(); i < c; i++) {
                System.out.println("Creator: " + array.getValue(i));
            }
        }
        prop = meta.getProperty(XMPConstants.DUBLIN_CORE_NAMESPACE, "title");
        if (prop != null) {
            System.out.println("Title: " + prop.getValue());
        }
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreateDate");
        if (prop != null) {
            System.out.println("Creation Date: " + prop.getValue());
        }
        prop = meta.getProperty(XMPConstants.XMP_BASIC_NAMESPACE, "CreatorTool");
        if (prop != null) {
            System.out.println("Creator Tool: " + prop.getValue());
        }
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "Producer");
        if (prop != null) {
            System.out.println("Producer: " + prop.getValue());
        }
        prop = meta.getProperty(XMPConstants.ADOBE_PDF_NAMESPACE, "PDFVersion");
        if (prop != null) {
            System.out.println("PDF version: " + prop.getValue());
        }
    }
View Full Code Here

    /**
     * @see org.apache.xmlgraphics.xmp.merge.PropertyMerger#merge(
     *          org.apache.xmlgraphics.xmp.XMPProperty, org.apache.xmlgraphics.xmp.Metadata)
     */
    public void merge(XMPProperty sourceProp, Metadata target) {
        XMPProperty existing = target.getProperty(sourceProp.getName());
        if (existing == null) {
            //simply copy over
            target.setProperty(sourceProp);
        } else {
            XMPArray array = existing.convertSimpleValueToArray(XMPArrayType.SEQ);
            XMPArray otherArray = sourceProp.getArrayValue();
            if (otherArray == null) {
                if (sourceProp.getXMLLang() != null) {
                    array.add(sourceProp.getValue().toString(), sourceProp.getXMLLang());
                } else {
View Full Code Here

     */
    public void setIdentifier(String value, String qualifier) {
        PropertyAccess pa = findQualifiedStructure(IDENTIFIER,
                XMPBasicSchema.SCHEME_QUALIFIER, qualifier);
        if (pa != null) {
            pa.setProperty(new XMPProperty(XMPConstants.RDF_VALUE, value));
        } else {
            XMPStructure struct = new XMPStructure();
            struct.setProperty(new XMPProperty(XMPConstants.RDF_VALUE, value));
            struct.setProperty(new XMPProperty(XMPBasicSchema.SCHEME_QUALIFIER, qualifier));
            addObjectToArray(IDENTIFIER, struct, XMPArrayType.BAG);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.xmlgraphics.xmp.XMPProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.