|
-
August 26th, 2005, 09:18 AM
#1
Ensuring valid XML element text
I have read about how to process XML and handle invalid text in element values; what I haven't been able to learn is: how do I ensure the text I _write_ as an XML element value is valid?
With VC++ 6.0, I'm reading text from an NTEXT database field and writing it with home-grown, text-based XML routines. (I'm not very familiar with DOM, but would be willing to work on it.)
Is there a way to pass the text thru some character encoding filter to ensure the ampersands (and all other special characters) get converted to & (and their corresponding &xxx; values) ?
Thanks for reading.
-
August 26th, 2005, 09:40 AM
#2
Re: Ensuring valid XML element text
 Originally Posted by joleary
Is there a way to pass the text thru some character encoding filter to ensure the ampersands (and all other special characters) get converted to & (and their corresponding &xxx; values) ?
Home based routines are nice as long as you are writting extremelly simple and well defined XML's. For the remaining 99% of cases : ) I would recommned using DOM or any other XML library. DOM ensures the XML text is valid and more.
Har Har
-
August 26th, 2005, 09:49 AM
#3
Re: Ensuring valid XML element text
Thanks for the quick reply PadexArt!
As my naive, home-grown XML writers are _everywhere_ in my system at the moment, can you point me to anything I can use in the meantime, even if I have to drop down (climb up?) into DOM do to a conversion on my string before I write it?
-
August 26th, 2005, 04:13 PM
#4
Re: Ensuring valid XML element text
I couldn't tell really. If I had to solve this problem either I would change it with DOM or would make mu own functions using the boost library. They have some pretty usefull string libs.
Har Har
-
August 26th, 2005, 04:58 PM
#5
Re: Ensuring valid XML element text
Thank you again for your consideration, PadexArt.
I'll look into the boost libraries.
In the meantime, anyone else have any ideas?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|