Author Topic: wxSmith and XML  (Read 7988 times)

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
wxSmith and XML
« on: March 26, 2009, 07:07:31 pm »
I have a minor (if unusual) problem.

While developing a new function for wxSmith, I noticed that when I store a wxArrayString as a property, the XML writer stores the entire array to the *.wxs file properly.  However, when reading it back in (on the next session) the XML reader compresses multiple space chars into a single space.  Normally this is not a problem, but in my case the space chars are significant.

Is there any (simple) way to turn off this behavior?

Thanks,
Ringo

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: wxSmith and XML
« Reply #1 on: March 26, 2009, 08:15:23 pm »
Is there any (simple) way to turn off this behavior?
I'm afraid not. wxSmith uses TinXML for it's resources. The reason for that behaviour lies in TinyXML which (by default) will condense white spaces.
See the interface description to SetCondenseWhiteSpace(...) in tinyxml.h for details. You will realise that this behaviour is also the standard behaviour as proposed (or silently acknowledged) by the XML standard.
BUT: If you really need un-condensed white-spaces, why don't you write a CData element? This should work just fine.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Re: wxSmith and XML
« Reply #2 on: March 26, 2009, 09:58:32 pm »
Yes, there are several work-arounds I could use (and will); I was just hoping for a "magic bullet" to save some time.

Thanks,
Ringo

Offline rcoll

  • Almost regular
  • **
  • Posts: 150
Re: wxSmith and XML
« Reply #3 on: March 26, 2009, 10:58:41 pm »
Er ... just a quick question about TinyXML .... shouldn't it be WRITING files with condensed spaces, rather than condensing them on input?  If I manually edit the *.wxs file, I can see my wxArrayString stored in all of it's whitespace glory; it's only when reading it back in that the white space is condensed.  Or am I confused (would not be the first time)?

Ringo

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: wxSmith and XML
« Reply #4 on: March 27, 2009, 11:12:09 am »
Or am I confused (would not be the first time)?
Now you got me confused. :-)

I need some more info:
- Are you using wxSmith and/or ConfigManager to read/write to the wxs file?
- Can you provide a sample wxs file with an array string?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: wxSmith and XML
« Reply #5 on: March 27, 2009, 11:19:58 am »
If I see it right, tinyxml only uses the value set with SetCondenseWhiteSpace(...) in ReadValue and ReadText, so it will save all spaces, but (if condenseWhiteSpace is set) condense them at read-time.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9699
Re: wxSmith and XML
« Reply #6 on: March 27, 2009, 11:41:16 am »
If I see it right, tinyxml only uses the value set with SetCondenseWhiteSpace(...) in ReadValue and ReadText, so it will save all spaces, but (if condenseWhiteSpace is set) condense them at read-time.
Hehe... that makes it clear. I'd say quite in-consequent, right?! The better default option would be to have the condensed variable to false so that it's the same when reading and writing...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ