Search in sources :

Example 66 with JDOMException

use of org.jdom.JDOMException in project beast-mcmc by beast-dev.

the class AbstractPolygon2D method readKMLFile.

public static List<AbstractPolygon2D> readKMLFile(String fileName) {
    List<AbstractPolygon2D> polygons = new ArrayList<AbstractPolygon2D>();
    try {
        SAXBuilder builder = new SAXBuilder();
        builder.setValidation(false);
        builder.setIgnoringElementContentWhitespace(true);
        Document doc = builder.build(new File(fileName));
        Element root = doc.getRootElement();
        if (!root.getName().equalsIgnoreCase("KML"))
            throw new RuntimeException("Not a KML file");
        readKMLElement(root, polygons);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (JDOMException e) {
        e.printStackTrace();
    }
    return polygons;
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) Element(org.jdom.Element) IOException(java.io.IOException) Document(org.jdom.Document) JDOMException(org.jdom.JDOMException) File(java.io.File)

Example 67 with JDOMException

use of org.jdom.JDOMException in project beast-mcmc by beast-dev.

the class XMLModelFile method main.

public static void main(String[] args) {
    //main method for debugging
    SAXBuilder parser = new SAXBuilder();
    Document doc;
    try {
        doc = parser.build(new File("testSimplePathSampling.xml"));
        XMLModelFile z = new XMLModelFile(doc.getRootElement());
        z.printIdentified();
        HashMap<String, String> hm = new HashMap<String, String>();
        hm.put("samplingMean", "samplingMean");
        z.prefixIdentifiedNames("model1.", hm, false);
        z.printIdentified();
    } catch (IOException e) {
    //
    } catch (JDOMException e) {
    //
    }
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) IOException(java.io.IOException) Document(org.jdom.Document) JDOMException(org.jdom.JDOMException) File(java.io.File)

Aggregations

JDOMException (org.jdom.JDOMException)67 IOException (java.io.IOException)55 Element (org.jdom.Element)44 Document (org.jdom.Document)22 File (java.io.File)17 SAXBuilder (org.jdom.input.SAXBuilder)15 VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 Nullable (org.jetbrains.annotations.Nullable)11 NotNull (org.jetbrains.annotations.NotNull)10 StringReader (java.io.StringReader)8 THashMap (gnu.trove.THashMap)6 ArrayList (java.util.ArrayList)6 List (java.util.List)6 InvalidDataException (com.intellij.openapi.util.InvalidDataException)5 Path (java.nio.file.Path)4 Logger (com.intellij.openapi.diagnostic.Logger)3 Project (com.intellij.openapi.project.Project)3 StringWriter (java.io.StringWriter)3 Format (org.jdom.output.Format)3 XMLOutputter (org.jdom.output.XMLOutputter)3