/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version: 1.3.19
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.sleepycat.dbxml;


public class XmlDocument {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  protected XmlDocument(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected void finalize() {
    delete();
  }

  public void delete() /* no exception */ {
    if(swigCPtr != 0 && swigCMemOwn) {
      dbxml_javaJNI.delete_XmlDocument(swigCPtr);
      swigCMemOwn = false;
    }
    swigCPtr = 0;
  }

  protected static long getCPtr(XmlDocument obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  public XmlDocument() throws XmlException {
    this(dbxml_javaJNI.new_XmlDocument(), true);
  }

  public int getID() { return dbxml_javaJNI.XmlDocument_getID(swigCPtr); }

  public void setName(String name) throws XmlException {
    dbxml_javaJNI.XmlDocument_setName(swigCPtr, name);
  }

  public String getName() throws XmlException {
    return dbxml_javaJNI.XmlDocument_getName(swigCPtr);
  }

  public void setContent(byte[] content) throws XmlException {
    dbxml_javaJNI.XmlDocument_setContent__SWIG_0(swigCPtr, content);
  }

  public byte[] getContent() { return dbxml_javaJNI.XmlDocument_getContent(swigCPtr); }

  public void setContent(String content) throws XmlException {
    dbxml_javaJNI.XmlDocument_setContent__SWIG_1(swigCPtr, content);
  }

  public void modifyDocument(XmlModify modify) throws XmlException {
    dbxml_javaJNI.XmlDocument_modifyDocument(swigCPtr, XmlModify.getCPtr(modify));
  }

  public String getContentAsString() throws XmlException {
    return dbxml_javaJNI.XmlDocument_getContentAsString(swigCPtr);
  }

  public void setMetaData(String uri, String prefix, String name, XmlValue value) throws XmlException {
    dbxml_javaJNI.XmlDocument_setMetaData(swigCPtr, uri, prefix, name, XmlValue.getCPtr(value));
  }

  public boolean getMetaData(String uri, String name, XmlValue value) throws XmlException {
    return dbxml_javaJNI.XmlDocument_getMetaData(swigCPtr, uri, name, XmlValue.getCPtr(value));
  }

  public XmlResults queryWithXPath(String query, XmlQueryContext context) throws XmlException {
    long cPtr = dbxml_javaJNI.XmlDocument_queryWithXPath__SWIG_0(swigCPtr, query, XmlQueryContext.getCPtr(context));
    return (cPtr == 0) ? null : new XmlResults(cPtr, true);
  }

  public XmlResults queryWithXPath(XmlQueryExpression query) throws XmlException {
    long cPtr = dbxml_javaJNI.XmlDocument_queryWithXPath__SWIG_1(swigCPtr, XmlQueryExpression.getCPtr(query));
    return (cPtr == 0) ? null : new XmlResults(cPtr, true);
  }

}
