
|
|
New: CookXml Wiki. IntroductionCookXml is a powerful general purpose dynamic XML data binding tool (unmarshalling only). Unlike JAXB, CookXml loads user defined tag libraries at runtime to convert XML documents into Java Object. The result is a highly configurable yet efficient XML parser. Another big difference CookXml has with JAXB is that CookXml does not use XML schema at all. JAXB uses XML -> Java design approach, but CookXml uses Java -> XML design approach. It is debatable which approach is better in general. However, if one already have Java classes to begin with, as in case of Swing component, clearly using CookXml is more straight foward. CookXml does unmarshalling only because it is the more difficult part of data binding. Most developers can easily output Java objects into XML format, but stumble at the reverse direction. Also, CookXml has the capability of executing of script languages embeded inside XML, which is not suitable for marshalling. How CookXml WorksCookXml uses the ideology of object factories, setters/getters, and adders, as the way to interpret a DOM tree, yet allowing advanced developers to inspect DOM elements if they wish. To use CookXml, one usually creates a tag library which controls how objects are created, modified, and linked together. Objects are created using factory objects whenever a tag is encountered. Their properties are in turn set when an attribute is seen, usually through default setter functions. Objects can be added to their parent objects in prefix or postfix order. Most things can be done using default constructor for the object, variables/setter functions, and an add function. So it is simple to write a tag library. CookXml is also designed to be easily extensible. If you create a new Java class, say MySlider based on JSlider, which is already in CookSwing tag library, you can create the new tag <myslider> with much less effort, by telling Swing tag library that <myslider> inherits <slider>. Instantly, <myslider> inherits all the efforts you put in setting <slider>'s attributes (notably dozens of Swing listeners related attributes), adding children, etc (well, probably just one or two lines of code using CookXml anyways, but still you are worry free from implementation changes I would make toward <slider>.). In addition, CookXml is so powerful that one could provide a tag library that turns XML into a complete language that can do pretty much anything doable in Java, although there is no point in doing so. My view on XML is that it serves as an excellent tool for headers, configuration files, XUL, communication protocols, and to some extent data storage. CookXml excels in dealing all these. I use CookXml extensively for personal and work related projects. For 90% of XML related parsing (not including XUL), I found that using CookXml is faster/easier to write. For the rest 10%, mostly query results in XML which contain a lot of different ignored tags/fields, I found direct DOM tree parsing can be faster/simpler. Then again, maybe it is just me that I dislike having to learn dozens of different XML libraries for the very tiny fraction of features I would be interested in. What's New
Sub Projects
The fundamental goal of CookSwing and CookSwt is to provide specific supports for GUI packages and free up programmers from doing tedious GUI hard coding and cleanup the code, WITHOUT compromising functionality. Yet, it is different from XMLEncoder/Decoder provided by JDK, which is tedious/unreadable in XML. CookXml/CookSwing/CookSwt intend to provide powerful yet concise representation of GUI (or whatever objects) in XML. I believe in writing a program that does well what it is supposed to do. I am not interested in a XUL that can be run anywhere; after all, Swing and SWT are portable themselves. If you are switching from Swing to SWT, or vice versa, tough luck with any XML toolkits. So, in the mean time, pick the one that provides the best use the GUI :) Scripting ExtensionsThe following extensions adds scripting capability to CookXml.
|