Escape character in java How can use double quote in string

S

Sanjeev

Dear Gurus,

I am trying to build a string i.e. XML content into string as follows.

XML file content as follows.

<?xml version="1.0" encoding="UTF-8"?>
<IFX xmlns:pain001="urn:swift:xsd:$pain.001.001.01"
xmlns:pain002="urn:swift:xsd:$pain.002.001.01"
xmlns:pain004="urn:swift:xsd:$pain.004.001.01"
xmlns:remit="http://www.ifxforum.org/RemitDetailInfo/2004/07"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\Documents and Settings\SIMYNYY
\Desktop\BSP\IFX\IFX1.7_XSD\IFX170_XSD.xsd"<Catlog>
<Employee>
<Name>Crow</Name>
<Id>3676</Id>
</Employee>
</Catlog>
</IFX>

When build a string and print using System.out.println();

String sendingMessage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"\n <IFX xmlns:pain001=\"urn:swift:xsd:$pain.
001.001.01\" xmlns:pain002=\"urn:swift:xsd:$pain.002.001.01\"
xmlns:pain004=\"urn:swift:xsd:$pain.004.001.01\" xmlns:remit=\"http://
www.ifxforum.org/RemitDetailInfo/2004/07\" xmlns:xsi=\"http://
www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"C:
\\Documents and Settings\\SIMYNYY\\Desktop\\BSP\\IFX\\IFX1.7_XSD\
\IFX170_XSD.xsd\" >" +
"\n <Message>" +
"\n <MsgHeader>" +

it gets print on console properly

But if pass this string to other method by invocation it gets print as
follows
<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
\n <IFX xmlns:pain001=\"urn:swift:xsd:$pain.001.001.01\"
xmlns:pain002=\"urn:swift:xsd:$pain.002.001.01\"
xmlns:pain004=\"urn:swift:xsd:$pain.004.001.01\"
xmlns:remit=\"http://www.ifxforum.org/RemitDetailInfo/2004/07\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:noNamespaceSchemaLocation=\"C:\\Documents and Settings\\SIMYNYY\
\Desktop\\BSP\\IFX\\IFX1.7_XSD\\IFX170_XSD.xsd\" >" +
\n <Message>
\n <MsgHeader>
....
....


Could anyone help me.

Sanjeev
 
A

Andrea Francia

Sanjeev said:
But if pass this string to other method by invocation it gets print as
follows
It difficult to think what is the problem without a SSCCE.
mindprod.com/jgloss/sscce.html
 
A

Andrea Francia

If it works with System.out.println() but not with the second method I
think that the second method you use do something wrong.
Could you post the code of this method?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top