We are using StAX parser to read the large XML files and strip off some of the elements/attributes and write the XML file
The source XML file is valid XML file i.e. have
Single quotes only need to be escaped if they occur in an attribute value enclosed by single quotes. There's not really any reason to escape them otherwise.