- match sv_type c with
- SVt_PV -> String (string_of_sv c)
- | SVt_RV -> Element (new html_element (deref c))
- | _ -> failwith "HTML::Element content_type: unknown type"
+ (* Not very satisfactory, but sv_type fails to discern the type
+ * for some reason. XXX
+ *)
+ let str = string_of_sv c in
+ let marker = "HTML::Element=HASH(" in
+ let marker_len = String.length marker in
+ if String.length str > marker_len &&
+ String.sub str 0 marker_len = marker then
+ Element (new html_element c)
+ else
+ String (string_of_sv c)