C# : Problem when transforming XML to doc using XSLTClass

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi all,
I am facing an issue when transforming an XML to document using XSLClass.
Error : <span style="font-size:11pt For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings into XmlReader.Create method

<pre>XslCompiledTransform xslt = new XslCompiledTransform();

// Execute the transform and output the results to a file.

xslt.Transform(xmlPath, outputPath);

MessageBox.Show("Success");[/code]
<br/>
Does anyone know the solution to fix this? I have also tried using XMLreader, see below
code. But, still it is the same error when the compiler parses at xslt.Transform statement

<pre lang="x-c# XmlReaderSettings xrs = new XmlReaderSettings();
xrs.ProhibitDtd = false;
xrs.XmlResolver = null;
xrs.IgnoreProcessingInstructions = true;

XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(XmlReader.Create(xslPath,xrs));

// Execute the transform and output the results to a file.
xslt.Transform(xmlPath, outputPath);
MessageBox.Show("Success");[/code]

<br/>

View the full article
 
Back
Top