parse string and insert in document