您的位置:程序门 -> web 开发 -> xml/soap



关于一个xmlserializer的问题(100分)


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


关于一个xmlserializer的问题(100分)
发表于:2007-06-19 14:19:07 楼主
xml如:
<?xml   version= "1.0 "   encoding= "utf-8 "   ?>
<?xml-stylesheet   type= 'text/xsl '   href= 'xsltfile1.xsl '?>
<student>
      <name> allen </name>
      <sex> male </sex>
</student>

cs文件:
using   system.xml.serialization;

namespace   xmlserializertest
{
        [system.codedom.compiler.generatedcodeattribute( "xsd ",   "2.0.50727.42 ")]
        [system.serializableattribute()]
        [system.diagnostics.debuggerstepthroughattribute()]
        [system.componentmodel.designercategoryattribute( "code ")]
        [system.xml.serialization.xmltypeattribute(anonymoustype   =   true)]
        public   partial   class   student
        {
                private   string   name   =   " ";
                private   string   sex   =   " ";

                [system.xml.serialization.xmlattributeattribute()]
                public   string   name
                {
                        get
                        {
                                return   name   ;
                        }
                        set
                        {
                                name   =   value;
                        }
                }

                [system.xml.serialization.xmlattributeattribute()]
                public   string   sex
                {
                        get
                        {
                                return   sex   ;
                        }
                        set
                        {
                                sex   =   value;
                        }
                }

        }
}


我现在的问题是:
      现在cs得到的xml没有 <?xml-stylesheet   type= 'text/xsl '   href= 'xsltfile1.xsl '?>
怎样才能加进cs文件中去???应该在cs中怎样写??
发表于:2007-06-22 09:12:391楼 得分:0
pi=oxmldomdocument.createnode(processinginstruction,   xml-stylesheet,   " ");
pi.setattribute( "type ",   "text/xsl ");
pi.setattribute( "href ",   "xsltfile1.xsl ");


快速检索

最新资讯
热门点击