Java Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Java Examples

Quick Start
Java Unicode
Java Certs
Java Email
Java Encryption
Java FTP
HTML-to-XML
Java HTTP
Java IMAP
Java MHT
Java MIME
Java RSA
Java S/MIME
Java Signatures
Java Socket
Java Spider
Java Tar
Java Upload
Java XML
Java XMP
Java Zip

More Examples...
Email Object
POP3
SMTP
RSS
Atom
String
Byte Array
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

Fetch XMP String Property from JPG

Java example code to open a JPG and fetch the value of a simple string property from within the XMP metadata.

Download Java Programming Examples

// Chilkat Java XMP Example Program
	
import com.chilkatsoft.CkXmp;
import com.chilkatsoft.CkXml;
import com.chilkatsoft.CkByteData;
import com.chilkatsoft.CkString;

public class XmpGetProp {
	
  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }
  
// Retrieve a simple string property from the XMP embedded within a JPG.

  public static void main(String argv[]) 
  {
    CkXmp xmp = new CkXmp();
    xmp.UnlockComponent("anything for 30-day trial");
    
	// Open a JPG containing XMP embedded metadata.
	boolean success = xmp.LoadAppFile("images/IndependantPhotographer-Example.jpg");
	if (!success)
	{
		xmp.SaveLastError("output/xmpError.xml");
		return;
	}
	
	// How many embedded XMP documents?
	int n = xmp.get_NumEmbedded();
	
	// Get the 1st XMP.
	CkXml xml = xmp.GetEmbedded(0);
	
	// Get the value of the Iptc4xmpCore:Location property.		
	String propVal = xmp.simpleStr(xml,"Iptc4xmpCore:Location");
	
	System.out.println(propVal);
  
  }
}





 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.