It is currently Sat Jul 21, 2018 3:59 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: XML problem with control characters (ascii 1-31)
PostPosted: Mon May 14, 2018 3:30 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jun 11, 2004 7:07 am
Posts: 558
XML 1.1 supports all ascii controls from $01 [SOH] to $1F [US]. But If you use that, then the correct characters are in the XML file after saving, but loading don't work:
Code:
Structure Person
  Name$
  Age.l
  List Books.s()
EndStructure

Define P.Person

P\Name$ = "John Smith " + Chr(17) + Chr(1) + " xxx" ; means [DC1] + [SOH]
P\Age   = 42
AddElement(P\Books()): P\Books() = "Investing For Dummies"
AddElement(P\Books()): P\Books() = "A Little Bit of Everything For Dummies"

Debug P\Name$
Debug P\Age

If CreateXML(0)
  InsertXMLStructure(RootXMLNode(0), @P, Person)
  FormatXML(0, #PB_XML_ReFormat)
  SaveXML(0, "test.xml")
  FreeXML(0)
EndIf

If LoadXML(0, "test.xml")
  ExtractXMLStructure(MainXMLNode(0), @P, Person)
  FreeXML(0)
EndIf

Debug P\Name$
Debug P\Age

saved XML-file is correct:
https://www.dropbox.com/s/gq6qi2jfvh0afkx/ascii-xml.png


Top
 Profile  
Reply with quote  
 Post subject: Re: XML problem with control characters (ascii 1-31)
PostPosted: Mon May 14, 2018 3:59 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jun 11, 2004 7:07 am
Posts: 558
Ah, OK, sorry, I see there is XML 1.0 supported only....


Top
 Profile  
Reply with quote  
 Post subject: Re: XML problem with control characters (ascii 1-31)
PostPosted: Fri May 18, 2018 7:35 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jun 11, 2004 7:07 am
Posts: 558
No bug. Please move this to the coding questions.

Question: Is it possible to catch invalid string characters in XML files?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye