Hello, im using this replace statemet:
fileText.Replace(“<xml version= “”“1.0 “”” encoding= “”“utf-8"”” > “,”<? xml version="""1.0""" encoding= """utf-8""" ?>")
But it is giving me an error saying: end of statement expected
Can anyone help.
Hello, im using this replace statemet:
fileText.Replace(“<xml version= “”“1.0 “”” encoding= “”“utf-8"”” > “,”<? xml version="""1.0""" encoding= """utf-8""" ?>")
But it is giving me an error saying: end of statement expected
Can anyone help.
Hi,
Can you try the following?
fileText.Replace("<xml version= ""1.0"" encoding= ""utf-8"" > ","<? xml version=""1.0"" encoding= ""utf-8"" ?>")
Regards,
Thanks, the error disappears, i thought you needed triple quotes.
Only problem now is its not replacing the text
Hi,
Can you share your original string and expected string?
Regards,
im having trouble pasting xml
Hi,
Can you try the following expression?
System.Text.RegularExpressions.Regex.Replace(yourString ,"(?<=\<\?xml\s[^\?\>]+)\>","?>")
Regards,
its still not replacing. This is my file before replacing:
Hi,
Sorry, the above is for adding latter “?”. How about the following?
System.Text.RegularExpressions.Regex.Replace(yourString.Replace("<xml ","<?xml "),"(?<=\<\?xml\s[^\?\>]+)\>","?>")
Regardfs,
That works, thanks man you are a life saver
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.