Re: structuring pull parsing code and using serializer [Re: [xmlpull-user] Java <-> XML using XMLPull]
Dennis Sosnoski <[email protected]> Sat, 01 Mar 2003 17:41:08 -0800
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Alek, I hadn't realized you'd done this JaxMe sample - very interesting, I wish I'd seen it earlier. I assume you've seen some of the comments about my JiBX project (http://www.jibx.org), which I discuss briefly in my data binding performance comparison article at http://www-106.ibm.com/developerworks/library/x-databdopt2/ A pull parser is the basis for this data binding implementation (currently XMLPull, but flexible to allow going with the Java standard once it comes out). I've got another pair of articles coming out within the next couple of weeks that discuss JiBX in more detail. In the case of JiBX I chose to wrap the pull parser interface completely within my unmarshalling context class, partially to avoid any dependencies on a particular parser API. The current CVS version (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jibx/distrib/build/src/org/jibx/runtime/UnmarshallingContext.java) doesn't have the full set of convenience methods I've since added but is otherwise pretty close to the final form. For marshalling, I use a similar context class with a variety of convenience methods to handle cases such as a start tag with or without attributes to be added, with and without content, etc. The CVS version of the marshalling code is lacking one refinement I've since added. In the CVS version I was planning to just combine namespace prefixes with local names directly in the code generation (essentially mapping namespaces to static prefixes depending on the context of an object within the binding definition). I've now made this dynamic, but based on a namespace index rather than a namespace URI. This allows me to avoid any runtime lookup of namespaces, while still allowing different prefixes to be used for the same namespace URI within a binding. It also allows for easy output convertion to SAX2 events or (with the aid of an intermediate buffer) XMLPull events. I'm working on getting my generated binding code (which is added directly into the class files) past the validator right now. I expect to get this all on the site by Monday, so I'll follow up with another email once it's all online. - Dennis Aleksander Slominski wrote: >that looks reasonable and i would like to make it into a real sample. >please take a look on this: >http://www.extreme.indiana.edu/~aslom/xml/databinding/jaxme-xmlpull/ > > ------------------------ Yahoo! Groups Sponsor ---------------------~--> New Yahoo! Mail Plus. More flexibility. More control. More power. Get POP access, more storage, more filters, and more. http://us.click.yahoo.com/Hcb0iA/P.iFAA/46VHAA/2U_rlB/TM ---------------------------------------------------------------------~-> To unsubscribe from this group, send an email to: [email protected] Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/