I’m using a textInputStream in order to show an XML file in a textArea, this is my code:
[code] Dim DecodedText As String
///Leyendo el XML para ver si tiene espacios en blanco
Dim AppFolder As FolderItem = SpecialFolder.Desktop.Child(“test.xml”)
If AppFolder <> Nil Then
If AppFolder .Exists Then
Dim t As TextInputStream
Try
t = TextInputStream.Open(AppFolder)
t.Encoding = Encodings.UTF8
DecodedText = t.ReadAll
t.Close
Catch e As IOException
MsgBox("Error accessing file.")
End Try
End If
The idea is the next, when I open an XML file that has spaces before start the code, delete that spaces, also I tried with TRIM,but without results.
What Am i doing wrong?
If trim isn’t removing the “spaces” then they’re not spaces or tabs, carriage returns or line feeds or any of the other whitespace that trim is intended to remove
They’re other “gremlins”
There’s likely a regex that could identify and replace those
Or you could run a loop that does a replaceall on characters - but that means you’d have to know all non-printing characters
[quote=265281:@Norman Palardy]If trim isn’t removing the “spaces” then they’re not spaces or tabs, carriage returns or line feeds or any of the other whitespace that trim is intended to remove
They’re other “gremlins”
There’s likely a regex that could identify and replace those
Or you could run a loop that does a replaceall on characters - but that means you’d have to know all non-printing characters[/quote]
But I made this Carriage returns to the test.xml file, in order to simulate that problem.