You must Sign In to post a response.
  • Category: ASP.NET

    How to send Ampersand along with text in XML

    Hi All,

    I was sending xml parameter to rest service like below

    <Envelope xmlns="http://w3gana/2003/05/soap-envelope">
    <Header>
    <To xmlns="http://www.w3.svc</To>
    </Header>
    <Body>
    <tns:RetRES>
    <tns:EmpDef>
    <studyChar>
    <I2:code code="QA Last" />
    <I2:value value="BDA & MAST" />
    </studyChar>
    </I2:planStd>
    </tns:EmpDef>
    </tns:RetRES>
    </Body>
    </Envelope>

    It was throwing error like "there is an unclosed literal string line 1" .

    I have tried following strings instead of & but still i'm getting the same error.

    &
    &amp;
    &
    &
    &

    Please help to resolve this











    ,
  • #763347
    & will work. For you xml & is not an issue.
    you have issue in the structure. Ex. you did not close the <To> tag. use the following xml.

    <Envelope xmlns="http://w3gana/2003/05/soap-envelope">
    <Header>
    <To xmlns="http://www.w3.svc"></To>
    </Header>
    <Body>
    <studyChar>
    <SC value="BDA & MAST" />
    </studyChar>
    </Body>
    </Envelope>
    </Envelope>

    By Nathan
    Direction is important than speed


Sign In to post your comments