Advertisement Jump to content
Sign in to follow this  

Whitespace characters in text nodes (Xerces XML)

This topic is 5202 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to parse xml files for a application im building using xerces xml library. I'm having trouble getting it to ignore whitespace characters in text nodes. I've set the includeIgnorableWhitespace property to false and it works when parsing a xml file with a schema but not on standalone xml files (no dtd or schema). Heres the code I use to parse the xml files
//Error handling not included

XercesDOMParser* parser = new XercesDOMParser();

ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();


As I mentioned the code works on xml files with schemas and removes leading/trailing whitespace characters and also ignores text nodes that only consist of whitespace characters when building the xml tree, but I can't get it to do the same thing with standalone xml files. Any help?

Share this post

Link to post
Share on other sites
i dont know anything about the parser you're using, but why not trim upon data request? eg. myTrimFunction(parser->getTag("something")); i dunno if thats acceptable for you though.

Share this post

Link to post
Share on other sites
Yeah, I could do that, but it should work using the parser. And essentially it should be the parser’s task not mine.

Standalone xml files are more common than schema ones and ignoring white-space makes more sense in a standalone file. I really want to know why it won’t work.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!