Re: strip

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I am going to assume your are talking about the & character in the URL.
The & character is only used as an escape character within xml and
needs to be replaced with & to be legal.

Your sample URL becomes
<Element1>http://overthetop.com?search=too%20much&amp;sort=populatity</Element1>,
which is valid XML and cam be used as is for hyperlinks.

Here is some sample code to replace & in a URL with &amp;

public static void ReplaceRegex()
{
// Regex search and replace
RegexOptions options = RegexOptions.None;
Regex regex = new Regex(@"&", options);
string input =
@"http://overthetop.com?search=too%20much&sort=populatity";;
string replacement = @"&amp;";
string result = regex.Replace(input, replacement);

// TODO: Do something with result
System.Windows.Forms.MessageBox.Show(result, "Replace");
}

.



Relevant Pages

  • Re: Putting a "<" in an attribute value (was about CDATA sections)
    ... > are ambiguous (section 2.4 essentially says numeric character ... is a lawyer :-) XML has inherited these definitions with very few ... Once validity is established, an application will receive ... <!DOCTYPE header [ ...
    (comp.text.xml)
  • Re: Future of LISP. Alternative to XML. Web 3.0?
    ... I didn't realize it meant literally the cr character within the ... instead of XML representation for queries and responses. ... using s-expressions instead of XML, nobody is going to use it, ... Do *any* of those LISP projects have a server I ...
    (comp.lang.lisp)
  • RE: System.ArgumentException: Illegal characters in path
    ... But I don't use any xml string at all in my web ... It is a default data type string and I wonder it ... cannot accept latin character since string accepts all utf-8 characters. ... Microsoft XML 3.0 SP1 ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Suppressing character entity transformation
    ... I was gently chastizing Pavel for a minor stylistic point. ... When XSLT reads in a document, character references and entity references are expanded; when it writes the document back out as either XML or HTML, it should re-create character references where they're necessary. ... You really want to fix that, along the lines he illustrated (issuing actual elements rather than text that looks like tags) before you do anything else. ...
    (comp.text.xml)
  • Re: 2 Questions about validations
    ... in SGML any character that is not defined as a name character ... >>(But XML 1.0 always requires one or more white space characters there.) ... When I read the XML 1.0 spec, it made sense to me (well, perhaps the ... Considering what you get in the SGML parse tree in the end, ...
    (comp.infosystems.www.authoring.html)