EDN Admin
Well-known member
I am trying to convert XML to HTML but got struck with the error as :
Data at the root level is invalid. Line 1, position 1
Here is my XML file
<?xml version="1.0"?><br/>
<notification><br/>
<project>Test Project</project><br/>
</notification>
Here is my XSL file
<?xml version="1.0" encoding="ISO-8859-1"?><br/>
<!-- Edited by XMLSpy --><br/>
<html xsl:version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/XSL/Transform " xmlns=" http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml <br/>
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE <br/>
<xsl:for-each select="notification <br/>
<div style="background-color:teal;color:white;padding:4px <br/>
<span style="font-weight:bold <xsl:value-of select="project"/><br/>
<br/>
</xsl:for-each>
</body><br/>
</html>
Here is my method which tries to convert XML to HTML
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small public<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small string<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
Trafo()
{
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small //the outputs
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small string<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
result = <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small ""<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ;
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small try
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
{
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xmlStringReader = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small (<span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small "Hello.xml"<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small );
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XPathDocument<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xPathDocument = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XPathDocument<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small (xmlStringReader);<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small // Create a reader to read the XSL.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xslStringReader = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small (<span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small "Hello.xsl"<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small );<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XmlTextReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xslTextReader = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XmlTextReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small (xslStringReader);<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small // Load the XSL into an XslTransform.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XslTransform<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xslTransform = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XslTransform<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ();<font face="Consolas" size="2 <font face="Consolas" size="2
xslTransform.Load(xslTextReader,
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small null<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ,
GetType().Assembly.Evidence);<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small // Perform the actual transformation and output
an HTML string.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringWriter<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
htmlStringWriter = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringWriter<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ();<font face="Consolas" size="2 <font face="Consolas" size="2
xslTransform.Transform(xPathDocument,
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small null<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ,
htmlStringWriter, <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small null<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small );<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small string<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
html = htmlStringWriter.ToString();
}
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small catch<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
(<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small Exception<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
ex)
{
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small //Console.WriteLine (ex.Message);
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small //ErrMsg = ex.Message;
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
}
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small return<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
result;
}
View the full article
Data at the root level is invalid. Line 1, position 1
Here is my XML file
<?xml version="1.0"?><br/>
<notification><br/>
<project>Test Project</project><br/>
</notification>
Here is my XSL file
<?xml version="1.0" encoding="ISO-8859-1"?><br/>
<!-- Edited by XMLSpy --><br/>
<html xsl:version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/XSL/Transform " xmlns=" http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml <br/>
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE <br/>
<xsl:for-each select="notification <br/>
<div style="background-color:teal;color:white;padding:4px <br/>
<span style="font-weight:bold <xsl:value-of select="project"/><br/>
<br/>
</xsl:for-each>
</body><br/>
</html>
Here is my method which tries to convert XML to HTML
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small public<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small string<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
Trafo()
{
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small //the outputs
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small string<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
result = <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small ""<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ;
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small try
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
{
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xmlStringReader = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small (<span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small "Hello.xml"<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small );
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XPathDocument<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xPathDocument = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XPathDocument<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small (xmlStringReader);<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small // Create a reader to read the XSL.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xslStringReader = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small (<span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small <span style="font-family:Consolas; color:#a31515; font-size:x-small "Hello.xsl"<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small );<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XmlTextReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xslTextReader = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XmlTextReader<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small (xslStringReader);<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small // Load the XSL into an XslTransform.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XslTransform<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
xslTransform = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small XslTransform<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ();<font face="Consolas" size="2 <font face="Consolas" size="2
xslTransform.Load(xslTextReader,
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small null<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ,
GetType().Assembly.Evidence);<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small // Perform the actual transformation and output
an HTML string.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringWriter<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
htmlStringWriter = <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small new<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small StringWriter<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ();<font face="Consolas" size="2 <font face="Consolas" size="2
xslTransform.Transform(xPathDocument,
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small null<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small ,
htmlStringWriter, <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small null<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small );<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small string<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
html = htmlStringWriter.ToString();
}
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small catch<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
(<span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small <span style="font-family:Consolas; color:#2b91af; font-size:x-small Exception<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
ex)
{
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small //Console.WriteLine (ex.Message);
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small <span style="font-family:Consolas; color:#008000; font-size:x-small //ErrMsg = ex.Message;
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
}
<font face="Consolas" size="2 <font face="Consolas" size="2
</font></font><font face="Consolas" size="2
</font>
<span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small <span style="font-family:Consolas; color:#0000ff; font-size:x-small return<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
result;
}
View the full article