MAP | SASAX Documents > Motivation [ <| 1| 2| > ] |
You should not manage state transition, if you use DOM(Document Object Model) API to parse XML document.
But DOM API requires (much?) more memory, because it builds DOM tree, which is corresponded to whole XML document, up on memory and returns it as you know.
On the other hand, SAX API requires less memory than DOM API, because it represents XML document structure not as data structure but as sequence of events(= method invocations). "Memory efficiency" and "event driven model" have an appeal.
NOTE: Of course, I know that not everyone likes "event driven model" always. "Event driven model" seems to be too complex for them.
DOM does not resolve complications from typeless-ness or poorness around namespace.
With schema language, like XML Schema, you do not have to examine correctness of XML document by yourself.
But you should still deserialize from string to other types, and manage document context(e.g.: current position in the nested structure) to build custom data structure up.
NOTE: Sorry, but I do not have evidence whether schema language resolves problem of prefixed value of element or attribute. It seems not to do so for me, but please tell me if it does.
XML binding seems to resovle context management and typeless-ness.
NOTE: Sorry, but I do not have evidence whether XML binding resolves problem of prefixed value of element or attribute. It seems not to do so for me, but please tell me if it does.
Now, I want to ask you: which do you want to "handle XML document", or "choose XML document format as one of ways for object marshaling" ?
XML binding seems to be a good solution if the former. It helps you to keep correctness and to serialize(again) data structure as XML document.
But is it too heavy for the later ? Containers generated by XML binding framework depends on the binding framework strongly.
Digester seems to resolve context management and typeless-ness, too.
NOTE: Sorry, but I do not have evidence whether Digester resolves problem of prefixed value of element or attribute. It seems not to do so for me, but please tell me if it does.
Then, why not Digester ?
Because I do not like method invocation based on reflection mechanism, which prevents compiler from examining correctness of program: you can not know whether method will be invoked successfully or not until program execution.
NOTE: I do not dislike reflection mechanism itself. It is usefull to instanciate, decorate or delegate request to the unknown class(or its instance).
In conclusion, I noticed that I want the framework which resolves not only problems described the former section, but also shown below:
And I also noticed that I must develop it by myself.
MAP | SASAX Documents > Motivation [ <| 1| 2| > ] |