What is the best way to handle large string constants in Java?
Imagine that I have a test fixture for SOAP and I want to send the following string:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<QuoteRequest xmlns="https://www.bcponline.co.uk">
<header>
<SourceCode>BN325</SourceCode>
<MessageSource>B2B3</MessageSource>
<Profile>B08A</Profile>
<Password>AP3U86V</Password>
<OperatorID>flightline</OperatorID>
<ShowWebOptions>0</ShowWebOptions>
</header>
<serviceSelection>
<ServiceProviderCode></ServiceProviderCode>
<ProductCode>CarParking</ProductCode>
<IATACode>lgw</IATACode>
</serviceSelection>
<quoteDetails>
<DepartureDate>21-Jun-2005</DepartureDate>
<DepartureTime>07:00</DepartureTime>
<ReturnDate>28-Jun-2005</ReturnDate>
<ReturnTime>07:00</ReturnTime>
<QuoteReference></QuoteReference>
<NoPax>1</NoPax>
</quoteDetails>
<sPostCode></sPostCode>
</QuoteRequest>
</soap:Body>
</soap:Envelope>
I'd rather not put quotes and pluses around every line. If I put it in a file it's extra code and it would be somewhat hard to put several strings in the same file. XML has problems escaping text (I have to use CDATA ugliness). Is there an easier way?