This topic is now archived and is closed to further replies.


This topic is 5142 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

One thing I''ve always struggled with is parsing text data. Say I have a fairly large file (From say, 500kb to a few mb or so), full of something like XML (Even maybe a .ini file, but I''ll use XML to explain my problem). How is the best way of reading in and handling this day other than using 3rd party XML APIs. Is it best to load the whole file into memory and parse it or read it in and parse it as I go. Would I read it in looking for opening ''<'' tags, read in the text until I come to the next ''>'' character, shift it to a structure like say XMLtag? Are there better methods than reading in character by character and copying each character to a different variable in memory? What''s the best way to handle these parsing problems in ANSI C without 3rd party libraries? What''s the best way to handle these parsing problems in C++ using only say, STL and no other rarely used libraries? Appreciate any help, I''ve been a hobby programmer for a fair while but this is one thing that, being somewhat of a perfectionist I''ve never been able to satisfy my understanding of. I''m fully self taught so get the feeling I''ve missed some things whilst learning that could help me. I haven''t yet read through Design Patterns, but is there a pattern that could help me in these situations? If so which one(s) and I''ll go read up some

Share this post

Link to post
Share on other sites