JAL-793 added ability to visualise raw BioJSON in the exported HTML using facebox
[jalview.git] / src / jalview / io / HtmlFile.java
index 4805b8e..dc14cc0 100644 (file)
@@ -87,13 +87,23 @@ public class HtmlFile extends AlignFile implements ComplexAlignFile
 
     try
     {
-      content = doc.getElementById("seqData");
+      boolean contentFromDiv = true;
+      // search for BioJSON data in div element with id seqData
+      content = doc.select("div[id=seqData]").first();
+      if (content == null)
+      {
+        contentFromDiv = false;
+        // search for BioJSON data in input element with id seqData
+        content = doc.getElementById("seqData");
+      }
+
       if (content == null)
       {
         errormessage = "The html document is not embedded with BioJSON data";
         throw new IOException(errormessage);
       }
-      JSONFile jsonFile = new JSONFile().parse(new StringReader(content
+      JSONFile jsonFile = new JSONFile().parse(new StringReader(
+              contentFromDiv ? content.text() : content
               .val()));
       this.seqs = jsonFile.getSeqs();
       this.seqGroups = jsonFile.getSeqGroups();