Connecting Tech Pros Worldwide Forums | Help | Site Map

XslTransform.Transform Arguments Obsolete?

Anthony Bouch
Guest
 
Posts: n/a
#1: Nov 11 '05
Can anyone tell me why I receive the following compiler warning after having
recently upgraded to VS.Net 2003 and .Net 1.1?

Warning CS0618: 'System.Xml.Xsl(System.Xml.XPath.IXPathNavigable,
System.Xml.Xsl.XsltArgumentList, System.Xml.XmlWriter)' is obsolete: 'You
should pass XmlResolver to Transform() method'

XPathDocument xmlData = new XPathDocument(memStream);
XslTransform xslTransform = new XslTransform();
xslTransform.Load("invoice.xsl");
xmlWriter = new XmlTextWriter("invoice.doc", null);
xslTransform.Transform(xmlData, null, xmlWriter);
xmlWriter.Flush();
xmlWriter.Close();


(My XML Document is coming from memoryStream that was produced by the
serialization of a class but this is not part of the problem)

?

Regards,

Tony




Oleg Tkachenko
Guest
 
Posts: n/a
#2: Nov 11 '05

re: XslTransform.Transform Arguments Obsolete?


Anthony Bouch wrote:
[color=blue]
> Can anyone tell me why I receive the following compiler warning after having
> recently upgraded to VS.Net 2003 and .Net 1.1?
>
> Warning CS0618: 'System.Xml.Xsl(System.Xml.XPath.IXPathNavigable,
> System.Xml.Xsl.XsltArgumentList, System.Xml.XmlWriter)' is obsolete: 'You
> should pass XmlResolver to Transform() method'[/color]
Because Transform() method you are using is obsolete in 1.1.
[color=blue]
> xslTransform.Transform(xmlData, null, xmlWriter);[/color]
This is obsolete, see
http://msdn.microsoft.com/library/de...formtopic7.asp

You should use this method instead:
http://msdn.microsoft.com/library/de...ormtopic15.asp

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Anthony Bouch
Guest
 
Posts: n/a
#3: Nov 11 '05

re: XslTransform.Transform Arguments Obsolete?


Thanks Oleg

xslTransform.Transform(xmlData, null, xmlWriter, null);

...does the job (as I don't need a resolver in this case)




"Oleg Tkachenko" <olegt@multiconn.com> wrote in message
news:OQ1kcf9PDHA.304@tk2msftngp13.phx.gbl...[color=blue]
> Anthony Bouch wrote:
>[color=green]
> > Can anyone tell me why I receive the following compiler warning after[/color][/color]
having[color=blue][color=green]
> > recently upgraded to VS.Net 2003 and .Net 1.1?
> >
> > Warning CS0618: 'System.Xml.Xsl(System.Xml.XPath.IXPathNavigable,
> > System.Xml.Xsl.XsltArgumentList, System.Xml.XmlWriter)' is obsolete:[/color][/color]
'You[color=blue][color=green]
> > should pass XmlResolver to Transform() method'[/color]
> Because Transform() method you are using is obsolete in 1.1.
>[color=green]
> > xslTransform.Transform(xmlData, null, xmlWriter);[/color]
> This is obsolete, see
>[/color]
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemxmlxslxsltransformclasstransformtopic7. asp[color=blue]
>
> You should use this method instead:
>[/color]
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemxmlxslxsltransformclasstransformtopic15 .asp[color=blue]
>
> --
> Oleg Tkachenko
> http://www.tkachenko.com/blog
> Multiconn Technologies, Israel
>[/color]


Closed Thread


Similar .NET Framework bytes