|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: SAX2: Interning names in namespaces
Terje Norderhaug wrote:
> SCRIPTERS
>
> A "scripter" is somebody that know string manipulation and other basic
> programming used commonplace in scripts, and have some graps of the
> namespace recommendation, but don't understand pointers and the difference
> between equality vs identity on a practical level. Scripters handle
[...]
> if (name.namespace.equals ("http://www.my.com/mynamespace")) {
> if (name.equals ("price")) ....
> else if (name.equals ("quantity")) .....
Adding a new field (namespace) to a final class (String) looks more like
a beginner's error than a scripter's code.
> PROGRAMMERS
>
> A "programmer" understands the implications of the namespace recommendation
> and are savvy in object oriented programming. Programmers are free to use
>
> String myPrice = internName("http://www.my.com/mynamespace", "price");
> String myQtyty = internName("http://www.my.com/mynamespace", "quantity");
>
> if (name == myPrice) ....
> else if (name == myQtyty) ....
>
> Under the proposal, programs that use SAX won't have to deal with namespace
> representations at runtime. Unless names are interned in namespaces,
> specialists would be limited to the less efficient techniques of beginners
> and scripters when using SAX.
Assume we have m namespaces and n elements each, and the SAX java
intering feature is activated. Your "programmers" code needs up to n*m
comparisons to find the right element. The "scripters" code
needs up to n+m comparisons only, so I would not call your "programmers"
code more efficient.
Best regards
Stefan Haustein
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








