Example usage for org.dom4j DocumentException DocumentException

List of usage examples for org.dom4j DocumentException DocumentException

Introduction

In this page you can find the example usage for org.dom4j DocumentException DocumentException.

Prototype

public DocumentException(Throwable cause) 

Source Link

Usage

From source file:org.pentaho.platform.config.PentahoObjectsConfig.java

License:Open Source License

public void setDocument(Document doc) throws DocumentException {
    Element rootElement = doc.getRootElement();
    if ((rootElement != null) && !doc.getRootElement().getName().equals(ROOT)) {
        throw new DocumentException(
                Messages.getInstance().getErrorString("PentahoObjectsConfig.ERROR_0001_INVALID_ROOT_ELEMENT")); //$NON-NLS-1$
    }//from  w  ww .jav  a2  s  . c om
    document = doc;
}

From source file:org.pentaho.platform.config.PentahoXml.java

License:Open Source License

public PentahoXml(Document doc) throws DocumentException {
    Element rootElement = doc.getRootElement();
    if ((rootElement != null) && !doc.getRootElement().getName().equals(ROOT_ELEMENT)) {
        throw new DocumentException(
                Messages.getInstance().getErrorString("PentahoXml.ERROR_0001_INVALID_ROOT_ELEMENT")); //$NON-NLS-1$ 
    }//from  w  w  w .j a va 2  s  . c o m
    document = doc;
}

From source file:org.pentaho.platform.config.SpringSecurityHibernateConfig.java

License:Open Source License

public SpringSecurityHibernateConfig(Document doc) throws DocumentException {
    Element rootElement = doc.getRootElement();
    if ((rootElement != null) && !doc.getRootElement().getName().equals(ROOT_ELEMENT)) {
        throw new DocumentException(
                Messages.getInstance().getErrorString("PentahoXml.ERROR_0001_INVALID_ROOT_ELEMENT")); //$NON-NLS-1$ 
    }/*  ww  w  .  j av a2 s .  com*/
    document = doc;
}

From source file:org.pentaho.platform.config.SystemActionsXml.java

License:Open Source License

public SystemActionsXml(Document doc) throws DocumentException {
    Element rootElement = doc.getRootElement();
    if ((rootElement != null) && !doc.getRootElement().getName().equals(ROOT_ELEMENT)) {
        throw new DocumentException(
                Messages.getInstance().getErrorString("PentahoXml.ERROR_0001_INVALID_ROOT_ELEMENT")); //$NON-NLS-1$ 
    }//from   www.jav  a 2 s.  c  om
    document = doc;
}

From source file:org.pentaho.platform.plugin.services.email.EmailConfigurationXml.java

License:Open Source License

private void loadFromConfigurationDocument(final Document doc) throws DocumentException {
    final Element rootElement = doc.getRootElement();
    if ((rootElement != null) && !doc.getRootElement().getName().equals(ROOT_ELEMENT)) {
        throw new DocumentException(
                messages.getErrorString("EmailConfigurationXml.ERROR_0002_INVALID_ROOT_ELEMENT")); //$NON-NLS-1$
    }/*from   w w  w  .  java 2 s  . c o m*/

    setSmtpHost(getStringValue(doc, SMTP_HOST_XPATH));
    setSmtpPort(getIntegerPortValue(doc, SMTP_PORT_XPATH));
    setSmtpProtocol(getStringValue(doc, SMTP_PROTOCOL_XPATH));
    setUseStartTls(getBooleanValue(doc, USE_START_TLS_XPATH));
    setAuthenticate(getBooleanValue(doc, AUTHENTICATE_XPATH));
    setUseSsl(getBooleanValue(doc, USE_SSL_XPATH));
    setDebug(getBooleanValue(doc, DEBUG_XPATH));
    setSmtpQuitWait(getBooleanValue(doc, SMTP_QUIT_WAIT_XPATH));

    setDefaultFrom(getStringValue(doc, DEFAULT_FROM_XPATH));
    setFromName(getStringValue(doc, FROM_NAME_XPATH));
    setUserId(getStringValue(doc, USER_ID_XPATH));
    setPassword(getStringValue(doc, PASSWORD_XPATH));
}

From source file:org.waarp.common.xml.XmlUtil.java

License:Open Source License

/**
 * /*w w  w. j a  v a2  s.c  om*/
 * @param ref
 * @param path
 * @return the parent element associated with the path relatively to the referent element
 * @throws DocumentException
 */
static public Element getParentElement(Element ref, String path) throws DocumentException {
    String npath = path;
    while (npath.charAt(0) == '/') {// startsWith("/")) {
        npath = npath.substring(1);
    }
    Element current = (Element) ref.selectSingleNode(npath);
    if (current == null) {
        throw new DocumentException("Node not found: " + path);
    }
    return current.getParent();
}

From source file:org.waarp.common.xml.XmlUtil.java

License:Open Source License

/**
 * //from  ww w  .jav a 2s. c  o m
 * @param ref
 * @param path
 * @return the element associated with the path relatively to the referent element
 * @throws DocumentException
 */
static public Element getElement(Element ref, String path) throws DocumentException {
    String npath = path;
    while (npath.charAt(0) == '/') {// .startsWith("/")) {
        npath = npath.substring(1);
    }
    Element current = (Element) ref.selectSingleNode(npath);
    if (current == null) {
        throw new DocumentException("Node not found: " + path);
    }
    return current;
}

From source file:org.waarp.common.xml.XmlUtil.java

License:Open Source License

/**
 * /*from   ww  w  . ja  v a 2  s. c  om*/
 * @param ref
 * @param path
 * @return the element associated with the path relatively to the referent element
 * @throws DocumentException
 */
@SuppressWarnings("unchecked")
static public List<Element> getElementMultiple(Element ref, String path) throws DocumentException {
    String npath = path;
    while (npath.charAt(0) == '/') {// .startsWith("/")) {
        npath = npath.substring(1);
    }
    List<Element> list = ref.selectNodes(npath);
    if (list == null || list.isEmpty()) {
        throw new DocumentException("Nodes not found: " + path);
    }
    return list;
}

From source file:org.waarp.common.xml.XmlUtil.java

License:Open Source License

/**
 * //ww  w  .  j  av  a 2  s .c om
 * @param doc
 * @param path
 * @return the Parent element associated with the path relatively to the document
 * @throws DocumentException
 */
static public Element getParentElement(Document doc, String path) throws DocumentException {
    Element current = (Element) doc.selectSingleNode(path);
    if (current == null) {
        throw new DocumentException("Node not found: " + path);
    }
    return current.getParent();
}

From source file:org.waarp.common.xml.XmlUtil.java

License:Open Source License

/**
 * // w ww.j  a  v  a2  s  .  c o  m
 * @param doc
 * @param path
 * @return the element associated with the path relatively to the document
 * @throws DocumentException
 */
static public Element getElement(Document doc, String path) throws DocumentException {
    Element current = (Element) doc.selectSingleNode(path);
    if (current == null) {
        throw new DocumentException("Node not found: " + path);
    }
    return current;
}