locked
Add XSD annotations to schemas in WCF RRS feed

  • Question

  • I am looking for some way to add annotations to XSD elements to imported schemas for my WCF service. I found very usefull example here: http://www.agilior.pt/blogs/bruno.camara/archive/2006/10/01/6.aspx
    The problem is that in this example annotations were provided by using IDataContractSurrogate.GetCustomDataToExport method. This method returns object of Object type that is serialized in XSD like this:
     <xs:annotation>  
    <
    xs:appinfo>
    <
    Surrogate i:type="d1p1 : string"
    xmlns
    ="http://schemas.microsoft.com/2003/10/Serialization/"
    xmlns : d1p1
    ="http://www.w3.org/2001/XMLSchema"
    xmlns:i
    ="http://www.w3.org/2001/XMLSchema-instance">This is the account balance</Surrogate>
    </xs:appinfo>
    </
    xs:annotation>
    But I need node <xs : documentation> instead of node <xs:appinfo> and I found no way how to control <xs:appinfo> node creating. Is there any other way to add XSD annotations to schemas in format:
    <xs:annotation>  
    <
    xs : documentation> This is the account balance </xs:documentation>
    </
    xs:annotation>
    Regards, Leonid.
    Sunday, May 11, 2008 11:29 AM

Answers

  • I am not aware of any built in mechanism for this other than using the extensibility points such as those from the blog you posted.  You could create a CustomEncoder that hooks in and re-uses the base encoder and simply override in certain circumstances, or you could make use of the MessageVersion.None property and craft your own customized XML body to use instead.

     

    Wednesday, May 14, 2008 11:25 PM

All replies

  • I am not aware of any built in mechanism for this other than using the extensibility points such as those from the blog you posted.  You could create a CustomEncoder that hooks in and re-uses the base encoder and simply override in certain circumstances, or you could make use of the MessageVersion.None property and craft your own customized XML body to use instead.

     

    Wednesday, May 14, 2008 11:25 PM
  • Hi, any update with this?
    Thursday, October 27, 2011 9:10 AM