xml

G

Guest

Is there a VB.NET function that will take a string and return it in a xml friendly string? My problem is this: Pal's Daycare is saved as Pal I lose everything after the '
 
M

Marc Butenko

You are going to have to do String.Replace to get replace the characters
that XML doesn't like, like the ' in your example before putting into XML.

--
Marc Butenko
(e-mail address removed)



rhogan said:
Is there a VB.NET function that will take a string and return it in a xml
friendly string? My problem is this: Pal's Daycare is saved as Pal I lose
everything after the '
 
J

Jim M

on the server side use....

Public Shared Function JREncode(ByVal in_string)

Dim sRtn As String

sRtn = in_string

sRtn = Replace(sRtn, "&", "&")

sRtn = Replace(sRtn, "<", "&lt;")

sRtn = Replace(sRtn, ">", "&gt;")

sRtn = Replace(sRtn, """", "&quot;")

sRtn = Replace(sRtn, "'", "&apos;")

JREncode = sRtn

End Function

on the client side use.....


function escapeXML(strInput)
{
// replace special characters that will error out in xml
strInput=strInput.replace(/&/g,"&amp;"); //replace & with &amp;
strInput=strInput.replace(/</g,"&lt;"); //replace < with &lt;
strInput=strInput.replace(/>/g,"&gt;"); //replace > with &gt;
strInput=strInput.replace(/"/g,"&quot;"); //replace " with &quot;
strInput=strInput.replace(/'/g,"&apos;"); //replace ' with &apos;

return(strInput);
}

rhogan said:
Is there a VB.NET function that will take a string and return it in a xml
friendly string? My problem is this: Pal's Daycare is saved as Pal I lose
everything after the '
 

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

Top