Re: [Simple-support] Any suggestion for static and dynamic xml content serialization
Brought to you by:
niallg
|
From: Mirza A. R. <abb...@ya...> - 2008-12-11 18:37:38
|
Just an idea - this is with just initial thought without looking at Simple's serialization code. Can we have an annotation like '@XmlLiteral', which basically just injects a literal xml element tag? Ofcourse, the client code is responsible for keeping the literal well formed. Thoughts?
________________________________
From: Niall Gallagher <gal...@ya...>
To: Niall Gallagher <gal...@ya...>; Mirza Abbas Raza <abb...@ya...>; sim...@li...
Sent: Wednesday, December 10, 2008 3:10:56 PM
Subject: Re: [Simple-support] Any suggestion for static and dynamic xml content serialization
Sorry, where I said "This is not detached from your object model" I meant "This is not atttached from your object model".
Niall
________________________________
From: Niall Gallagher <gal...@ya...>
To: Mirza Abbas Raza <abb...@ya...>; sim...@li...
Sent: Wednesday, December 10, 2008 11:09:04 PM
Subject: Re: [Simple-support] Any suggestion for static and dynamic xml content serialization
Hi,
Well here is what I am thinking. Are you going to be writing more or less code to add static data to the document. I mean if I were to write a decorator that would match the element name or class to complement the attributes and elements like so.
public void decorate(OutputNode node) {
if(x) {
node.addSomething();
} else {
node.addSomethingElse();
}
}
This is not detached from your object model, ant it will be much harder to maintain. Take XStream where the XML structure is not attached to the object. You have to bind by somethiing else, things become difficult to trace. In what way is it associated and how to you know it is. Do you follow the call hierarchies, do you trace the types matched, is it obvious to someone that is new to this code. I would imagine not. It is scattered code, not fundamentally associated with your object model. You just end up writing more code. I realise adding redundant fields or methods is not ideal for your code. But is there any way that involves less coding and is more obvious? I can't think of any simple way to do this that requires less effort and is more obvious than annotating a field. I you can I am very interested.
Look forward to hearing your suggestions,
Niall
________________________________
From: Mirza Abbas Raza <abb...@ya...>
To: Niall Gallagher <gal...@ya...>; sim...@li...
Sent: Wednesday, December 10, 2008 10:19:37 PM
Subject: Re: [Simple-support] Any suggestion for static and dynamic xml content serialization
First off, thanks for the quick reply. The elements typeId, templateId, id, code etc. sprayed around in the document are static. They do not change. Rest of the other elements like custodian, participant etc. are dynamic. The static content has to be be just sticked in. I have not thought in detail about how I would inject in those static elements. Probably I will have objects that read the text literals from a configuration file and have them as instance variables. This is just a thought at this point. Suggestions?
Thanks!
________________________________
From: Niall Gallagher <gal...@ya...>
To: Mirza Abbas Raza <abb...@ya...>; sim...@li...
Sent: Wednesday, December 10, 2008 11:48:12 AM
Subject: Re: [Simple-support] Any suggestion for static and dynamic xml content serialization
Hi,
Took a look at the document, it looks pretty easy to parse. However, I
am not sure what you mean by static content? What difference has this
to the dynamic content, that it does not change? If so what do you need
to achieve, and how do you envision handling static content and how would it differ from dynamic content?
Regards,
Niall
________________________________
From: Mirza Abbas Raza <abb...@ya...>
To: sim...@li...
Sent: Wednesday, December 10, 2008 7:23:18 PM
Subject: [Simple-support] Any suggestion for static and dynamic xml content serialization
Hi,
In the XML that I have to serialize, the content is roughly 20% static (Standardized IDs and such) and 80% dynamic. The document in question is the Continuity of Care Document (http://www.himssehrva.org/ASP/CCD_QSG_20071112.asp). I am debating using XSLT/XSD based serializers or annotation based libraries. With XSLT based serializers, the nice thing is that the static content can easily be extracted out in the XSLT. However, the performance takes the hit with the process of creating the XML in the first place and doing the transformation. Also, one would have to maintain the XSLT. On the other hand, with Simple, we would not have to maintain any XMLs/XSLTs and the performance would be better on the premise that there are fewer steps involved in serialization. The only downside I see is to produce static content in Java. Is there any mechanism that Simple can provide to handle this issue? At this point, from the tutorial, I did not find one. Appreciate
any help.
Thanks,
Abbas |