Saving + Loading XML changes stored strings
Posted: Fri Jun 29, 2018 10:31 am
If you save a string with line breaks as a formated XML and you load this file again, then the string has changed. Is this a normal behaviour? Or a bug? It seems to me, information from inside the string and outside from the formatting are mixed...
Code: Select all
Input
"That is a test
That is PureBasic
A third line"
Output
"
That is a test
That is PureBasic
A third line
"
Code: Select all
EnableExplicit
Structure simple
text.s
EndStructure
Define var.simple
var\text = "That is a test" + #CR$ + "That is PureBasic" + #CR$ + "A third line"
Debug "Input"
Debug #DQUOTE$ + var\text + #DQUOTE$
Debug ""
; Save XML
CreateXML(0)
InsertXMLStructure(RootXMLNode(0), var, simple)
FormatXML(0, #PB_XML_ReFormat)
SaveXML(0, "test.xml")
FreeXML(0)
; Load XML
CreateXML(0)
LoadXML(0, "test.xml")
ExtractXMLStructure(MainXMLNode(0), var, simple)
FreeXML(0)
Debug "Output"
Debug #DQUOTE$ + var\text + #DQUOTE$
Debug ""