Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting Carriage Returns / Line Feeds

Status
Not open for further replies.

ToddWW

Programmer
Mar 25, 2001
1,073
US
I have a customer posting an XML string inside a single form element to one of our ASP pages. Unfortunately, the data in the form element contains carriage returns and line feeds. It appears that their B2B software is putting those in there. I need to be able to detect those because I'm doing some validation on the first few lines of the XML string before I load it into XML Document Object Model.

For example, using the Instr method, here's how it looks now.

Code:
IF Instr(Request.Form(&quot;xmldata&quot;),&quot;<?xml version=&quot;&quot;1.0&quot;&quot;?><!DOCTYPE Document SYSTEM &quot;&quot;fq1xml.dtd&quot;&quot;>&quot;) <> 1 THEN

In between the first two XML elements, there is a carriage return and a line feed. How can I detect those so I can include them in the examination. I tried the following, but did not work.

Code:
IF Instr(Request.Form(&quot;xmldata&quot;),&quot;<?xml version=&quot;&quot;1.0&quot;&quot;?>&quot; & chr(13) & &quot;<!DOCTYPE Document SYSTEM &quot;&quot;fq1xml.dtd&quot;&quot;>&quot;) <> 1 THEN


I think another example would be how to detect carriage returns in a scrolling text box form element (like the one I'm typing into right now) using server side ASP.

Thanks a million in advance.

ToddWW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top