JAL-2805 allow for non-xsd validating phyloxml parsing
[jalview.git] / src / jalview / ext / forester / io / ForesterParser.java
index a6d7831..469463e 100644 (file)
@@ -1,5 +1,6 @@
 package jalview.ext.forester.io;
 
+import jalview.ext.archaeopteryx.AptxInit;
 import jalview.ext.archaeopteryx.Tree;
 import jalview.ext.treeviewer.TreeI;
 import jalview.ext.treeviewer.TreeParserI;
@@ -30,15 +31,26 @@ public class ForesterParser
   public static ForesterParser createNexusParser(File file)
           throws PhylogenyParserException, IOException
   {
+    NexusPhylogeniesParser nxParser = new NexusPhylogeniesParser();
+    nxParser.setReplaceUnderscores(
+            AptxInit.APTX_CONFIG.isReplaceUnderscoresInNhParsing());
+    nxParser.setIgnoreQuotes(false);
     return new ForesterParser(new NexusPhylogeniesParser(), file);
   }
 
   public static ForesterParser createPhyloXmlParser(File file)
           throws PhylogenyParserException, IOException
   {
-    // support non-xsd validating?
+    if (AptxInit.APTX_CONFIG.isValidatePhyloXmlAgainstSchema())
+    {
     return new ForesterParser(
-            PhyloXmlParser.createPhyloXmlParserXsdValidating(), file);
+              PhyloXmlParser.createPhyloXmlParserXsdValidating(), file);
+    }
+    else
+    {
+      return new ForesterParser(PhyloXmlParser.createPhyloXmlParser(),
+              file);
+    }
   }
 
   // ParserBasedPhylogenyFactory.getInstance().create(foresterParser, source)