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
/* 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
Post a Comment