Thread: GMSI
View Single Post
Old 06-24-2009, 05:08 PM   #17
gekko's Avatar
Join Date: Nov 2007
Posts: 129

Submissions (1)

gekko will become famous soon enough (33)gekko will become famous soon enough (33)


nice. However, you should escape html special chars in the input automatically (a matcher could do that most quickly).

Btw thoses &...; things you call "htmlCode" are called entity.

Maybe you should have a stack of opened tags, not only one last opened tag. If you had that stack and opened 3 tags inside each other, you could just call closeTag 3 times to close them all 3 (the innermost first of course).

Your method that takes attributes as an array is still a bit unsatisfying. You just print the attributes behind each other without whitespaces. A better solution:
Let it take an array with string keys, where the key is the attribute name and its content is the value. Then, you can make the method just print them like that:
(assuming i is now the iterating string
s += " " + i + "=\"" + atts[i] + "\""; 

You can check out my xml library from YouTD. It does stuff like that. The nice thing is it can automatically transform an arbitrary struct into its xml encoding.
My stuff can be found at

Check out latest GMSI !
gekko is offline   Reply With Quote