Escape character in java How can use double quote in string

Discussion in 'Java' started by Sanjeev, May 2, 2008.

  1. Sanjeev

    Sanjeev Guest

    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
     
    Sanjeev, May 2, 2008
    #1
    1. Advertising

  2. Sanjeev wrote:
    > 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

    --
    Andrea Francia
    alias rm='trash' #use trash command instead of removing
    rm -Rfv file #put the file in the KDE trashcan
    http://www.andreafrancia.it/trash
     
    Andrea Francia, May 2, 2008
    #2
    1. Advertising

  3. Sanjeev

    Roedy Green Guest

    Roedy Green, May 3, 2008
    #3
  4. Andrea Francia wrote:
    > Sanjeev wrote:
    >> But if pass this string to other method by invocation it gets print as
    >> follows

    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?

    --
    Andrea Francia
    alias rm='trash' #use trash command instead of removing
    rm -Rfv file #put the file in the KDE trashcan
    http://www.andreafrancia.it/trash
     
    Andrea Francia, May 3, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    13,425
  2. Eric Layman
    Replies:
    3
    Views:
    665
    Rad [Visual C# MVP]
    Apr 14, 2007
  3. Alden Streeter

    Javascript double quote escape character?

    Alden Streeter, Nov 24, 2003, in forum: ASP General
    Replies:
    1
    Views:
    305
    Alden Streeter
    Nov 26, 2003
  4. Alvaro Perez

    Double quote escape character

    Alvaro Perez, Aug 16, 2007, in forum: Ruby
    Replies:
    11
    Views:
    258
    Phrogz
    Aug 16, 2007
  5. vikrant
    Replies:
    8
    Views:
    393
    vikrant
    May 17, 2007
Loading...

Share This Page