Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Qname Binding(Mapping to XML QName)
Qname Binding [message #716254] Tue, 16 August 2011 15:40 Go to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
Hello,

When we design the XML we might use the XML QName for some the element types. Right with Sapphire we don't have the luxury of having do serialization of such feature.

To overcome this we need to write a CustomXMLValueBinding + DerivedValue feature to make a up a QName xmlbinding.

I used this successfully in serializing QNamed elements to xml. The design approach i followed is,



  • Couple of CustomXMLValueBinding Classes one for QNameSpaceUriValueBinding and LocalPartValueBinding - both could be in same class but just made a Separation of Concerns
  • A common model element called IQName with three properties namely NamespaceUri, LocalPart and Prefix
  • Model elements that tends to have QNamed element can use this common model element as their type
  • the property that will be of QName type will use the DerivedValueService that will compute the QName from IQName's NamespaceUri, LocalPart and Prefix


Not sure its the best design as per Sapphire Standards Confused

I was successfully use above mentioned design in Serializing an QNamed XML element, it works well for ValueProperty & Implied R/W, but when I use it with List properties its able to sucessfully write but reading its not able to do , i feel i need to provide an CustomXmlListBinding implementation for that Confused

Ofcourse some code cleanup but there is always betterment and improvement to it.
Any possibility of adding this as an feature to future versions of Sapphire so its available out of the box and follows Sapphire Design principles ?

PS: I have attached the sources which i used for this purpose.

~Kamesh
Re: Qname Binding [message #716620 is a reply to message #716254] Wed, 17 August 2011 18:00 Go to previous message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
Maybe write this up on Sapphire wiki where code is easier to view and copy than from a .rar file attached to a forum post? If there is broader interest in this, we can see about incorporating it into the framework.

http://wiki.eclipse.org/Sapphire

- Konstantin
Previous Topic:DerivedValue
Next Topic:Model Validation Messages
Goto Forum:
  


Current Time: Fri Aug 22 13:41:38 EDT 2014

Powered by FUDForum. Page generated in 0.02980 seconds