473,471 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

removing linebreaks from xml files

1 New Member
I written a vb.net app that reads the contents of an xml file and sets a textbox with one of the elements. I can read the file fine and seperate it but for the life of me can't figure out how to get the newlines from being displayed as 'squares' I've tried replacing them to no avail. here is what I've tried so far:

Expand|Select|Wrap|Line Numbers
  1.            recDirections &= _step(i).InnerText
  2.            recDirections.Replace(vbCr, " ")
  3.            recDirections.Replace(vbLf, " ")
  4.            recDirections.Replace(vbCrLf, " ")
  5.            recDirections.Replace("\n", " ")
  6.            recDirections.Replace(vbNewLine, " ")
  7.            recDirections.Replace(Chr(10), " ")
  8.            recDirections.Replace(Chr(13), " ")
  9.            recDirections.Replace(Chr(10) & Chr(13), " ")
  10.  
none of these work and I'm at my witts end on this one. I think the problem is with the way the xml file is made, with returns on long lines so that it wraps but I'm not sure. If it is the case, it wouldn't solve my problem as the xml files are made by other users. Any ideas welcome
Mar 28 '08 #1
1 1114
balabaster
797 Recognized Expert Contributor
I written a vb.net app that reads the contents of an xml file and sets a textbox with one of the elements. I can read the file fine and seperate it but for the life of me can't figure out how to get the newlines from being displayed as 'squares' I've tried replacing them to no avail. here is what I've tried so far:

Expand|Select|Wrap|Line Numbers
  1. recDirections &= _step(i).InnerText
  2. recDirections.Replace(vbCr, " ")
  3. recDirections.Replace(vbLf, " ")
  4. recDirections.Replace(vbCrLf, " ")
  5. recDirections.Replace("\n", " ")
  6. recDirections.Replace(vbNewLine, " ")
  7. recDirections.Replace(Chr(10), " ")
  8. recDirections.Replace(Chr(13), " ")
  9. recDirections.Replace(Chr(10) & Chr(13), " ")
  10.  
none of these work and I'm at my witts end on this one. I think the problem is with the way the xml file is made, with returns on long lines so that it wraps but I'm not sure. If it is the case, it wouldn't solve my problem as the xml files are made by other users. Any ideas welcome
Have you tried:
recDirections = recDirections.Replace(Chr(10), ControlChars.Cr)
recDirections = recDirections.Replace(Chr(13), ControlChars.Lf)

You're not ending up replacing anything...because you're not actually assigning the directions with the replaced values to anything...
Mar 28 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Tomba | last post by:
hi there, I am looking for a way to convert line breaks that are written in a textarea (with an enter) to <br> to create the same line break in html is there anyone who can help me with this?...
5
by: Mechphisto | last post by:
I'm using a textarea to insert some notes into a database. It's inserting the complete result into the mySQL table including the linebreaks...and not as a visible symbol but an actual linebreak. If...
6
by: bart_nessux | last post by:
Hello, I have some Macbinary files on a PC. I want to recursively read these files and remove the first 128 bytes of the files if they contain the macbinary header info. I know how to read...
3
by: Jeff Thies | last post by:
I need a quick way to count linebreaks. This is slug slow: function findLinebreaks(str) { var re='/\r\n|\n|\r\|\f/g'; var i=0; while(re.match(str)){ i++;} return i; }
2
by: Stefan Landgraf | last post by:
Hi there! How can i replace linebreaks with <br> in datalist output ? Is there a way i can do that in the aspx page itself without having to go through the code page? Thanks Stefan
2
by: caspardh | last post by:
i was trying to code a morse code decipherer which workd fine except that the .txt file that i was converting had linebreaks built in, i cant get python to ignore the line breaks and i cant find any...
2
by: peter | last post by:
I have a xslt that writes a txt file from xml. Xml file is generated by a user input on a webpage and some nodes have linebreaks which corrupts my output. is there a way to generally set that xslt...
1
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
I want to match some HTML string using Regex but the linebreaks are getting me. Is there a way to just completely ignore linebreaks in my regular expression? If not, how would I specify a...
5
by: rweth | last post by:
I am using nntplib to download archived xml messages from our internal newsgroup. This is working fine except the download of files to the connected server, has extra embedded lines in them (all...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.