我想在我的序列化类中添加一个名称空间和前缀属性,以便我的子元素可以使用前缀进行引用。
我的班级看起来像这样:
[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>