S
Spitfire
Whenever I parse an XML file, using a DOM parser, I get a DOM object
which I can use to access whichever element I want to extract. However,
I cannot mutate any of them in place, preserving therefore the
consistency of the values in the object. How do I design such a class if
I have to for another similar purpose?
Imagine a scenario in which I construct my own XML/HTML parser. So my
parser takes a URL or a file and then constructs a DOM object which
represents the entire parsed doc. How do I design this DOM object class?
I want to have variables which the other classes can only see, but not
modify! I want to have methods which the other class can invoke, like
'getElementsByName' ... etc. I'm stuck in finalizing the design of the
class. This is just for academic purposes and therefore lets keep
advices against 'reinventing the wheel' away for a while.
which I can use to access whichever element I want to extract. However,
I cannot mutate any of them in place, preserving therefore the
consistency of the values in the object. How do I design such a class if
I have to for another similar purpose?
Imagine a scenario in which I construct my own XML/HTML parser. So my
parser takes a URL or a file and then constructs a DOM object which
represents the entire parsed doc. How do I design this DOM object class?
I want to have variables which the other classes can only see, but not
modify! I want to have methods which the other class can invoke, like
'getElementsByName' ... etc. I'm stuck in finalizing the design of the
class. This is just for academic purposes and therefore lets keep
advices against 'reinventing the wheel' away for a while.