How to change the xmlns attribute on the root when XmlSerialization?


when serializing xml, of course, default, shows these namespaces below:

<package xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"

however, how can change these attribute values "xmlns:xsi" , "xmlns:xsd" following values:

<package xmlns="http://www.wfmc.org/2002/xpdl1.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">

i had at xmlserializernamespaces class , not find clues this.

anyone has ideas?

thanks in advance.


justin


with solution should easy change both, xsi , xsd:
/* create xml namespace pairs */
    xmlserializernamespaces namespaces = new xmlserializernamespaces();
    namespaces.add( "yd", "www.diranieh.com" ); // here add xsd namespaces

    /* serialize file */
    stream stream = new filestream( "namespaces.xml", filemode.create, fileaccess.write, fileshare.write );
    xmlserializer serializer = new xmlserializer( typeof( xmlnamespaceserialization.books ) );
    serializer.serialize( stream, books, namespaces );
    stream.close();

source:
http://www.diranieh.com/netserialization/xmlserialization.htm


Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

How to Share webservice object to all user

How to fix error Msg 1801, Level 16, State 3, Line 1