JAL-1859 refactoring / debugging added
[jalview.git] / src / jalview / io / HtmlFile.java
index 4805b8e..06c2717 100644 (file)
@@ -87,14 +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
-              .val()));
+      JSONFile jsonFile = new JSONFile().parse(new StringReader(
+              contentFromDiv ? content.text() : content.val()));
       this.seqs = jsonFile.getSeqs();
       this.seqGroups = jsonFile.getSeqGroups();
       this.annotations = jsonFile.getAnnotations();
@@ -109,7 +118,6 @@ public class HtmlFile extends AlignFile implements ComplexAlignFile
     }
   }
 
-
   @Override
   public String print()
   {