Comparing the Java and C Implementations


Comparing the Java and C++ Implementations

In the previous chapter we talked about the differences in DOM support, error handling, and native language features. We again see differences between the two implementations, and a common theme emerges. While C++ with MSXML is a bit more complex in some areas due to setting up the COM environment and checking for COM errors, the code that actually does the DOM- related functions is much more concise . The load and save operations are single calls with no setup. Compare this with the corresponding operations in JAXP and Xerces. Creating a Document requires a DocumentBuilderFactory, a DocumentBuilder, and finally a call to the create or parse method. Saving a Document using the XML Serializer is even more involved.

To me, this is more reflective of the languages than anything else. Java tends to be fairly sparse in the code needed to do things like string manipulation and error handling, whereas it tends to be "class crazy" in its APIs. There is a wealth of classes, but finding the one that provides the functionality you need sometimes can take a bit of searching. C++, on the other hand, requires more code for error handling and string manipulation (at least when using char arrays, as discussed in Chapter 1). Where functionality is provided through an API or built-in language feature, C++ tends to be fairly concise.

Again, we see a great deal of similarity in the areas that the DOM Level 2 recommendation deals with and divergence in the areas where it is silent.



Using XML with Legacy Business Applications
Using XML with Legacy Business Applications
ISBN: 0321154940
EAN: 2147483647
Year: 2003
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net