Added methods to escape apostrophes and quotes in withText and withAttribute methods