将xmlns:rim属性添加到序列化类

时间:2011-09-22 21:15:15

标签: c# wcf soap xml-serialization

我想在我的序列化类中添加一个名称空间和前缀属性,以便我的子元素可以使用前缀进行引用。

我的班级看起来像这样:

    [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.opengis.net/cat/csw/2.0.2")]
    public partial class SearchResultsType
    {

        private object[] itemsField;

        private string resultSetIdField;

        private ElementSetType elementSetField;

        private bool elementSetFieldSpecified; 
...

现在它正在回归:

<SearchResults recordSchema="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
    <RegistryPackage id="urn:ogc:def:registryPackage:OGC-CSW-ebRIM-EO::EOProducts" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:RegistryPackage"/>
</SearchResults>

我希望它更像这样:

<SearchResults xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" recordSchema="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0">
    <rim:RegistryPackage id="urn:ogc:def:registryPackage:OGC-CSW-ebRIM-EO::EOProducts" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:RegistryPackage"/>
</SearchResults>

0 个答案:

没有答案