关于一个XMLSerializer的问题(100分)
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中怎样写??
[解决办法]
pi=oXMLDOMDocument.createNode(processinginstruction, xml-stylesheet, " ");
pi.setAttribute( "type ", "text/xsl ");
pi.setAttribute( "href ", "XSLTFile1.xsl ");
[解决办法]
pi=oXMLDOMDocument.createNode(processinginstruction, xml-stylesheet, " ");
pi.setAttribute( "type ", "text/xsl ");
pi.setAttribute( "href ", "XSLTFile1.xsl ");