c# - understanding xmlns tags in a WCF response -



c# - understanding xmlns tags in a WCF response -

this question has reply here:

xmltypeattribute works on attributes in class 1 reply

i'm trying modify wcf service , have problems understanding namespaces , xmlns tags in response.

this datatype in iservice file, , has tag namespace:

[system.codedom.compiler.generatedcodeattribute("svcutil", "3.0.4506.2152")] [system.serializableattribute()] [system.diagnostics.debuggerstepthroughattribute()] [system.componentmodel.designercategoryattribute("code")] [system.xml.serialization.xmltypeattribute(namespace="http://www.zz.com/x/domain")] public partial class discrepancytype { private string barcodefield; private string classificationfield; private bool commentrequiredfield; private string descriptionfield; private int discrepancytypeidfield; private system.nullable<int> usagerankfield; private string usecaseidfield; /// <remarks/> [system.xml.serialization.xmlelementattribute(order=0)] public string barcode { { homecoming this.barcodefield; } set { this.barcodefield = value; } } /// <remarks/> [system.xml.serialization.xmlelementattribute(order=1)] public string classification { { homecoming this.classificationfield; } set { this.classificationfield = value; } } /// <remarks/> [system.xml.serialization.xmlelementattribute(order=2)] public bool commentrequired { { homecoming this.commentrequiredfield; } set { this.commentrequiredfield = value; } } /// <remarks/> [system.xml.serialization.xmlelementattribute(order=3)] public string description { { homecoming this.descriptionfield; } set { this.descriptionfield = value; } } /// <remarks/> [system.xml.serialization.xmlelementattribute(order=4)] public int discrepancytypeid { { homecoming this.discrepancytypeidfield; } set { this.discrepancytypeidfield = value; } } /// <remarks/> [system.xml.serialization.xmlelementattribute(isnullable=true, order=5)] public system.nullable<int> usagerank { { homecoming this.usagerankfield; } set { this.usagerankfield = value; } } /// <remarks/> [system.xml.serialization.xmlelementattribute(order=6)] public string usecaseid { { homecoming this.usecaseidfield; } set { this.usecaseidfield = value; } } }

in response, next result. don't understand why xlmns tag in each attribute, want have domain in discrepancytype tag. how can prepare this?

<discrepancytype> <barcode xmlns="http://www.zz.com/x/domain"></barcode> <classification xmlns="http://www.zz.com/x/domain"></classification> <commentrequired xmlns="http://www.zz.com/x/domain"></commentrequired> <description xmlns="http://www.zz.com/x/domain"></description> <discrepancytypeid xmlns="http://www.zz.com/x/domain"></discrepancytypeid> <usagerank xmlns="http://www.zz.com/x/domain"></usagerank> <usecaseid xmlns="http://www.zz.com/x/domain"></usecaseid> </discrepancytype>

please have @ omitting xsi , xsd namespaces when serializing object in .net

the of import section clear namespace while serializing. illustration serializing method like:

public string serialize() { var author = new stringwriter(); var ns = new xmlserializernamespaces(); ns.add("", ""); var serializer = new xmlserializer(typeof(discrepancytype)); serializer.serialize(writer, this, ns); homecoming writer.tostring(); }

c# xml wcf xml-namespaces

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -