[ contact ] [ home ] [ search ] [ submit link ] login | want to join? register in seconds!

home and garden
lawyers reviews
cosmetic surgery
cosmetic surgery cost / price site
channels:
hot tags: [all tags...]
hot tags(2): [all tags...]
[all tags...]
Simple 1 2 Java XML Serialization
tech related articles:
0
vote!
Epson's 4990 Scanner (www.byte.com)
crawler @ 03/30/07 12:36 comments(0) report
0
vote!
Rooting Out Spyware (www.byte.com)
crawler @ 04/02/07 13:21 comments(0) report
0
vote!
The Reverse Challenge (www.byte.com)
crawler @ 04/02/07 13:21 comments(0) report
0
vote!
How to Write a Chess-Playing Program, Part 1 (www.byte.com)
crawler @ 03/30/07 12:36 comments(0) report
0
vote!
Treos and Tribulations (www.byte.com)
crawler @ 03/30/07 12:36 comments(0) report
0
vote!
Digital Rights, Digital Wrongs (www.byte.com)
crawler @ 03/30/07 12:36 comments(0) report
Simple 1.2 - Java XML Serialization
" XML serialization framework has released version 1.2. Simple is is a serialization framework for Java that enables rapid development of XML configuration and communication systems. Its goal is to provide an XML serialization framework that requires no configuration or mappings to serialize objects to and from human readable XML. Below is a list of some of the capabilities of the framework."

"The framework used to provide XML serialization is simple to use and revolves around several annotations an a single persister object used to read and write objects to and from XML. Both serialization and deserialization are fully supported."

"Unlike many of the XML frameworks for Java there are no mappings or configuration required to serialize objects regardless of its complexity, not even code to establish mappings. Everything is done at runtime, only annotations are required to perform the object to XML structure. The XML schema is represented using field and method annotations."

"A primary goal for the framework is that the XML data used to deserialize and serialize objects is human readable. All XML elements and attributes take a simple structure that can be easily created with a text editor. Also the serialization format is compatible with the C# XML serialization format."

"As part of the deserialization process template markers within the XML elements and attributes can be replaced with variables. This allows the system to be easily adapted for use as a configuration system with dynamic value substitution. Stock template filers include OS environment variable substitution, system properties, as well as an API that enables custom filters to be introduced."

"During serialization and deserialization an object can recieve persister callbacks, to validate and prepare data during the process. Each callback allows the object to manipulate the persistance session, which allows values to be passed in to and out of the templating engine, and allows arbitrary attributes to be passed between the persisable objects."

"The serialization and deserialization process is controlled by an exensible strategy API, which allows objects to be created based on custom XML attributes. This allows interception of the object creation in order to delegate instantiation to object factories."

"For Java 6 the framework has no external dependancies and is completely self contained. For Java 5 two external JAR files are required, the StAX API and the StAX implementation, both are provided with the download."

"Released under the LGPL and so can be fully integrated or adapted for both commercial and open source projects."

" Introduction looks fine. But it is funny that "absolutely no configuration" declared - code should be annotated, this is kind of configuration anyway, useful for simple things but not flexible of course. "

" Annotating the class fields and methods establishes a schema. Are you telling me C# XML serialization, JAXB 2.0 reflection, JPA annotations and other such schema definitions are inflexible. "

"For any serialization system strict mappings are essential. XML tools that require configuration for mappings are error prone and tightly coupled."

"Yes (in this example) in that people shouldnt in the vast majority of situations be defining JPA ORM information in their classes since the target environment is an RDBMS and people would have to edit classes and recompile if they ever wanted to redeploy their class onto a different datastore. For that reason one of the spec owners has even said the same."

"As always annotations should only be used where applicable, rather than the current tendency to overuse. Whether they are in your use-case I've no idea - it would be for your users to expound their use-case situations which would define if "configuration" is desirable. "

" Firstly I think XStream is a cool tool for performing serialization. However I feel that the XML format it uses is not very readable as it has poor attribute support. It makes it less attractive to use for configuration purposes."

"Also, XStream tends to make use of mapping code over annotations, which I am not a fan of. I feel this form of mapping is ugly and fragile, it also takes longer to code and does not have great reuse. With the Simple API you write your objects and plug them together in fields and methods, every thing can be reused. "

"Finally, although the focus of XStream is serialization, which I feel it does well it is not easily adapted for other uses such as configuration systems. Simple allows you to create template variables which can be manipulated via a serialization session. "

" One can always [unless you're on a truly ancient JVM] just use the JVM's built-in XMLEncoder/XMLDecoder and/or wrap these with a little XML transformation on both ends. "

"When serializing very large object graphs, or graphs with any degree of complication the cycles are broken on deserialization and you have a completly different object, that often won't do. This means that you must always consider the mappings, even if it intrudes in to your object model/design."

"Simple allows optional integration cycle stategies. Which leads to verbatim deserialization and a more efficient XML format. "

"Firstly I think XStream is a cool tool for performing serialization. However I feel that the XML format it uses is not very readable as it has poor attribute support. It makes it less attractive to use for configuration purposes."

"Finally, although the focus of XStream is serialization, which I feel it does well it is not easily adapted for other uses such as configuration systems. Simple allows you to create template variables which can be manipulated via a serialization session."

"We use XStream in JMeter and it works great. To me, the mapping approach is more flexible than using annotations. I disagree that XStream is not good for configuration. JMeter test plans are basically configuration, and it works just fine."

"Using annotations to tell the application how to serialize objects out to XML is very similar to how serialization works in .NET. The biggest problem I've seen with .NET approach is that you can't do transformations easily. To do that, you'd need to use mapping. my bias 2 cents"

" For simple serialization I usually use XStream, although I'll check this out next time it comes up and see how it compares. For anything more complex, nothing compares to JiBX. "

" I would argue that Simple can deal with much more complex situations that a binding framework like JiBX. If you have existing POJO's that you don't want to modify all you have to do is annotate them, the full object graph can then be transferred to XML and back again. "

"I have not used JiBX but I find it hard to believe an XML schema can describe more complex relationships than Java can, or more to the point better relationships than the Java language can for a Java runtime. "

"I would argue that Simple can deal with much more complex situations that a binding framework like JiBX. If you have existing POJO's that you don't want to modify all you have to do is annotate them, the full object graph can then be transferred to XML and back again. "

"I have not used JiBX but I find it hard to believe an XML schema can describe more complex relationships than Java can, or more to the point better relationships than the Java language can for a Java runtime."

"JiBX has a mapping language, which allows you to map multiple XML formats to 1 object model. Or one could read a single XML format and unmarshall it to multiple object models. Using annotations is only going to work if you have 1 model and use java. What happens if you're doing integration between different systems and platforms?"

"I would suggest looking at JiBX. The author of JiBX Dennis participates in JAXB spec and has years of experience with XML-to-Object serialization."

" I have to say, I'm a huge fan of XStream. I recently had a case where a customer wanted to stuff an Object into a text field
... read the whole article


comments:(log in to vote on this article or comment on it)