News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

wxSmith and XML

Started by rcoll, March 26, 2009, 07:07:31 PM

Previous topic - Next topic

rcoll

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

MortenMacFly

Quote from: rcoll on March 26, 2009, 07:07:31 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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

rcoll

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

rcoll

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

MortenMacFly

Quote from: rcoll on March 26, 2009, 10:58:41 PM
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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Jenna

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.

MortenMacFly

Quote from: jens 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.
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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]