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.guzz.builder.HbmXMLBuilder.java

License:Apache License

public static String getDomainClassDbGroup(Element root) throws DocumentException, IOException, SAXException {
    List bus = root.selectNodes("//class");

    if (bus == null)
        return null;
    if (bus.size() != 1) {
        throw new DocumentException("too many class name");
    }/*from   ww  w .ja  v a  2  s  .co m*/
    Element e = (Element) bus.get(0);

    return e.attributeValue("dbGroup");
}

From source file:org.mule.module.xml.transformer.XmlPrettyPrinter.java

License:Open Source License

@Override
protected Object doTransform(Object src, String outputEncoding) throws TransformerException {
    try {/*  w  ww .  ja v  a  2 s.c  om*/
        Document document = XMLUtils.toDocument(src, muleContext);
        if (document != null) {
            ByteArrayOutputStream resultStream = new ByteArrayOutputStream();
            XMLWriter writer = new XMLWriter(resultStream, this.getOutputFormat());
            writer.write(document);
            writer.close();
            return resultStream.toString(outputEncoding);
        } else {
            throw new DocumentException("Payload is not valid XML");
        }
    } catch (Exception e) {
        throw new TransformerException(this, e);
    }
}

From source file:org.pdfsam.guiclient.utils.xml.XMLParser.java

License:Open Source License

/**
 * parse the xml input file/*from w  w w  .  ja  v a  2 s . co m*/
 * @param inputFile
 * @return parsed Document
 * @throws DocumentException
 */
public static Document parseXmlFile(File inputFile) throws DocumentException {
    Document document = null;
    if (inputFile.isFile()) {
        SAXReader reader = new SAXReader();
        document = reader.read(inputFile);
    } else {
        throw new DocumentException("Unable to read " + inputFile + ".");
    }
    return document;
}

From source file:org.pentaho.pac.server.config.AbstractDiagnosticsJmxXml.java

License:Open Source License

public AbstractDiagnosticsJmxXml(Document jmxDocument) throws DocumentException {
    if (jmxDocument != null) {
        Element rootElement = jmxDocument.getRootElement();
        if ((rootElement != null) && !jmxDocument.getRootElement().getName().equals(ROOT_ELEMENT)) {
            throw new DocumentException(
                    Messages.getErrorString("GoogleMapsConfig.ERROR_0001_INVALID_ROOT_ELEMENT")); //$NON-NLS-1$
        }/*from   ww  w.  ja va 2  s .  c  om*/
        document = jmxDocument;
    }
}

From source file:org.pentaho.pac.server.config.ConsoleConfigXml.java

License:Open Source License

public ConsoleConfigXml(Document doc) throws DocumentException {
    Element rootElement = doc.getRootElement();
    if ((rootElement != null) && !doc.getRootElement().getName().equals(ROOT_ELEMENT)) {
        throw new DocumentException("Invalid root element.");
    }//  w  w  w  .j  a v a2 s . c  om
    document = doc;
}

From source file:org.pentaho.pac.server.config.EmailConfigXml.java

License:Open Source License

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

From source file:org.pentaho.pac.server.config.GoogleMapsConfigXml.java

License:Open Source License

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

From source file:org.pentaho.pac.server.config.HibernateConfigXml.java

License:Open Source License

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

From source file:org.pentaho.pac.server.config.HibernateSettingsXml.java

License:Open Source License

public HibernateSettingsXml(Document doc) throws DocumentException {
    Element rootElement = doc.getRootElement();
    if ((rootElement != null) && !doc.getRootElement().getName().equals(ROOT_ELEMENT)) {
        throw new DocumentException(
                Messages.getErrorString("HibernateSettingsXml.ERROR_0001_INVALID_ROOT_ELEMENT")); //$NON-NLS-1$
    }/*w  ww  .  java  2  s .  c om*/
    document = doc;
}

From source file:org.pentaho.pac.server.config.PdiConfigXml.java

License:Open Source License

public PdiConfigXml(Document doc) throws DocumentException {
    Element rootElement = doc.getRootElement();
    if ((rootElement != null) && !doc.getRootElement().getName().equals(ROOT_ELEMENT)) {
        throw new DocumentException("Invalid root element"); //$NON-NLS-1$
    }//from w  w w. j av  a2 s. c om
    document = doc;
}