- content = doc.getElementById("seqData");
-
- JSONFile jsonFile = new JSONFile().parse(new StringReader(content.val()));
+ doc = Jsoup.parse(htmlData.toString());
+ } catch (OutOfMemoryError oom)
+ {
+ errormessage = "Not enough memory to process HTML document";
+ throw new IOException(errormessage);
+ }
+
+ try
+ {
+ 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(
+ contentFromDiv ? content.text() : content.val()));