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
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
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.
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.