make generic _to_stream use the stream write fcn
fix << operator for documents (compile error), and use in to_std_str for document element