Sample code for 30+ languages & platforms
Java

Load XML from Local FilePath

Demonstrates how to load XML from a local XML file.

Chilkat Java Downloads

Java
import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    boolean success = false;

    CkXml xml = new CkXml();

    //  Pass either an absolute file path, or a file path relative from the current working directory of the caller.
    success = xml.LoadXmlFile("qa_data/hamlet.xml");
    if (success == false) {
        System.out.println(xml.lastErrorText());
        return;
        }

    System.out.println("Success.");
  }
}