2
Vote

Feature Request: DefaultWrapperAttribute

description

Used to wrap literal content into objects while loading xoml into an object tree.
 
Xaml equivalent: ContentWrapperAttribute
 
Implementation differences: Can be applied also to properties not just to classes. The optional Converter property can be used to specify an explicit type converter (System.ComponentModel.TypeConverter) if TypeConverterAttribute cannot be applied to the wrapper class. If no type converter can be determinated and no default conversion exists between string and wrapper class, the xoml loader lookup for a constructor with a single string parameter.
 
Future enhancements / suggestions:
 
1) Full control of whiltespace handling through optional ContentWrapperAttribute properties called PreserveSpace and StripSpace (implemented like xsl:preserve-space and xsl:strip-space; see http://www.xmlplease.com/whitespace#h2-4).
 
Example:
<text> This is a test</text> ==> text = "This is a test" OR text = " This is a test" (PreserveSpace)
<text> This is <i>a</i> <b>test</b></text> ==> text = "This is <i>a</i> <b>test</b>" OR text = "This is <i>a</i><b>test</b>" (StripSpace)
 
2) Optional Propertiy SplitOption to split a literal content before wrapping.
 
Example:
<list>1 2 3 4 5</list> ==> list = {1, 2, 3, 4, 5} (SplitOption.WhiteSpace)
<list>
1
2
</list> ==> list = {1, 2} (SplitOption.LineFeed)

comments