Ok. We already have xml document parsing where its imperative. Like after we fetch this xml we run it against a xsl transformation to produce the new xml as required by the external system. Then this new xml is subjected to dtd validation where it check if its compliant with dtd as published by the external system.
All this processing happens within something called as event listeners of a content management system where in we take these events(xml payload), transforms them & send those events to the external system in their xml format.
Why we resorted to using String manipulation & not a full fledged parser style code is to avoid the processing time within these event listeners as looking at the frequency at which the events get published we cannot have this whole processing consume a lot of time per event.
So wherever its imperative we use the xml parser utilities & where we can avoid we resorted to quick string manipulation.
I reckon we ovverlooked the xml declaration earlier & did not account that into the input while we were doing preliminary
testing & carried out our initial testing without the xml declaration.
Now when we received the actual event xml we encountered this situtation.
So wanted to know a way of handling that xml declaration as part of the String.
Yea its always better to do this via xml parser way. Just reasoning out the approach we followed.
Thanks for all your responses