Larry Menten writes:
But the use of elements does require that the parsed elements be cached until enough
information has been collected to parse them. Except for trivial examples, this means that
you will be allocating memory dynamically to store these until you have collected enough
elements to identify and configure the target object.
...
You have provided just the leaf. With JUNOS you must retain the entire
tree in memory:
...
I am storing just the name, namespace ID, and attribute list for one
single element.
Given that the data is hierarchical in nature, how does using
attributes relieve you from tracking where you are in the configuration
hierarchy? You've got to know the parent hierarchy for your particular
element, so you need to track the same information. Attributes may
change the form of the data, but not what you need to do with it.
SAX may give you a complete set of attributes at once, but it will
normally allocate memory for these strings before handing them to
your code. I'm not following the element-implies-dom-implies-big
progression, mostly 'cause we use element, don't use DOM, and have
a fairly small footprint.
Thanks,
Phil
If you are familiar with GOF terminaology, we use a facade class tree
that represents the