我正在将 VB6 代码转换为 C#.net。IXSLProcessor xslProcessor.input 采用 DomDocument 但我有 XmlDocument。在强制转换(从 xml 到 DomDocument)时,它会引发异常。是否可以将 XmlDocument 转换为 DomDocument?代码是
Object vntRetVal;
ADODB.Stream objStream;
XSLTemplate xsl;
IXSLProcessor xslProcessor;
DocSys.IField objField = null;
String strFormatting=string.Empty;
String strValue;
Boolean blnManual;
XmlElement nd;
int m;
int n;
String[] bstr;
object[] astr = null;
objStream = new ADODB.Stream();
objStream.Open()
xslProcessor = xsl.createProcessor();
xslProcessor.addParameter("mergeindex", m_Model.MailMerge.Items.Current);
DOMDocument dom1 = new DOMDocument();
dom1 =(DOMDocument)m_Model.Document.get_Data;
xslProcessor.input = dom1;
xslProcessor.output = objStream;
xslProcessor.transform();
objStream.Position = 0;
strValue = objStream.ReadText();