By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,376 Members | 1,581 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,376 IT Pros & Developers. It's quick & easy.

C# extension functions using MSXML?

P: n/a
I'm having performance/memory problems using .NET's XslTransform class so I
thought I'd give the MSXML object's a whirl.

The question I haven't been able to find in these groups is can I use C#
extension functions with the MSXML objects? More specifically to use a C#
class which has all my extension functions.

I've seen examples where the stylesheet uses the <msxsl:script> element and
embeds C# code, but that's not a viable solution for my situation since I'll
be maintaining lots of different stylesheets which require the same
extension functions. (if I make one edit to an extension function, I don't
want to open up 20 other files and make the same edits)

Thanks,
-A
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Alfred Taylor wrote:
I'm having performance/memory problems using .NET's XslTransform class so I
thought I'd give the MSXML object's a whirl.
Have you optimized your code, as recommended in "Improving XML
Performance" paper? [1]
The question I haven't been able to find in these groups is can I use C#
extension functions with the MSXML objects? More specifically to use a C#
class which has all my extension functions.
You cannot. MSXML only supports scripting languages like JScript or
VBScript for extension functions.
Well, basically COM can call .NET code via interop (read about COM
Callable Wrappers in .NET), so you can register a .NET assembly on the
machine and then call its methods from COM.
But I doubt that's going to improve your perf problem, not to mention
lots of additional problems with interop. You can try it though.
I've seen examples where the stylesheet uses the <msxsl:script> element and
embeds C# code, but that's not a viable solution for my situation since I'll
be maintaining lots of different stylesheets which require the same
extension functions. (if I make one edit to an extension function, I don't
want to open up 20 other files and make the same edits)


That won't work with MSXML anyway.

[1]
http://msdn.microsoft.com/library/de...netchapt09.asp

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2

P: n/a
Alfred Taylor wrote:
I'm having performance/memory problems using .NET's XslTransform class so I
thought I'd give the MSXML object's a whirl.
Have you optimized your code, as recommended in "Improving XML
Performance" paper? [1]
The question I haven't been able to find in these groups is can I use C#
extension functions with the MSXML objects? More specifically to use a C#
class which has all my extension functions.
You cannot. MSXML only supports scripting languages like JScript or
VBScript for extension functions.
Well, basically COM can call .NET code via interop (read about COM
Callable Wrappers in .NET), so you can register a .NET assembly on the
machine and then call its methods from COM.
But I doubt that's going to improve your perf problem, not to mention
lots of additional problems with interop. You can try it though.
I've seen examples where the stylesheet uses the <msxsl:script> element and
embeds C# code, but that's not a viable solution for my situation since I'll
be maintaining lots of different stylesheets which require the same
extension functions. (if I make one edit to an extension function, I don't
want to open up 20 other files and make the same edits)


That won't work with MSXML anyway.

[1]
http://msdn.microsoft.com/library/de...netchapt09.asp

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #3

P: n/a
Hi Oleg,

Thanks for your response. I have a couple questions below.

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:<ex**************@TK2MSFTNGP11.phx.gbl>...
Alfred Taylor wrote:
I'm having performance/memory problems using .NET's XslTransform class so I thought I'd give the MSXML object's a whirl.
Have you optimized your code, as recommended in "Improving XML
Performance" paper? [1]


Nope, looks like the article came out last month so I haven't come across it
yet. Looks like a good comprehensive article which I'll be sure to read.
The question I haven't been able to find in these groups is can I use C#
extension functions with the MSXML objects? More specifically to use a C# class which has all my extension functions.
You cannot. MSXML only supports scripting languages like JScript or
VBScript for extension functions.


Slightly confused here. You say no here, but it looks like below you say it
is possible through COM. Is that right?
Well, basically COM can call .NET code via interop (read about COM
Callable Wrappers in .NET), so you can register a .NET assembly on the
machine and then call its methods from COM.
But I doubt that's going to improve your perf problem, not to mention
lots of additional problems with interop. You can try it though.
I'm familiar with creating CCW in .NET, just not with the syntax of MSXML.
I don't suppose you could provide a quick example of how you would use a COM
object for extension functions in MSXML? The other thing is, a lot of
people compare the speed improvements of MSXML over the .NET implementation,
however, not much is mentioned about memory. For my particular situation,
I'm more concerned with memory. How do the two implementations compare? Is
it neglible enough to not bother wasting my time testing MSXML?

Thanks,
-Alfred
I've seen examples where the stylesheet uses the <msxsl:script> element and embeds C# code, but that's not a viable solution for my situation since I'll be maintaining lots of different stylesheets which require the same
extension functions. (if I make one edit to an extension function, I don't want to open up 20 other files and make the same edits)
That won't work with MSXML anyway.

[1]

http://msdn.microsoft.com/library/de...netchapt09.asp
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #4

P: n/a
Hi Oleg,

Thanks for your response. I have a couple questions below.

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:<ex**************@TK2MSFTNGP11.phx.gbl>...
Alfred Taylor wrote:
I'm having performance/memory problems using .NET's XslTransform class so I thought I'd give the MSXML object's a whirl.
Have you optimized your code, as recommended in "Improving XML
Performance" paper? [1]


Nope, looks like the article came out last month so I haven't come across it
yet. Looks like a good comprehensive article which I'll be sure to read.
The question I haven't been able to find in these groups is can I use C#
extension functions with the MSXML objects? More specifically to use a C# class which has all my extension functions.
You cannot. MSXML only supports scripting languages like JScript or
VBScript for extension functions.


Slightly confused here. You say no here, but it looks like below you say it
is possible through COM. Is that right?
Well, basically COM can call .NET code via interop (read about COM
Callable Wrappers in .NET), so you can register a .NET assembly on the
machine and then call its methods from COM.
But I doubt that's going to improve your perf problem, not to mention
lots of additional problems with interop. You can try it though.
I'm familiar with creating CCW in .NET, just not with the syntax of MSXML.
I don't suppose you could provide a quick example of how you would use a COM
object for extension functions in MSXML? The other thing is, a lot of
people compare the speed improvements of MSXML over the .NET implementation,
however, not much is mentioned about memory. For my particular situation,
I'm more concerned with memory. How do the two implementations compare? Is
it neglible enough to not bother wasting my time testing MSXML?

Thanks,
-Alfred
I've seen examples where the stylesheet uses the <msxsl:script> element and embeds C# code, but that's not a viable solution for my situation since I'll be maintaining lots of different stylesheets which require the same
extension functions. (if I make one edit to an extension function, I don't want to open up 20 other files and make the same edits)
That won't work with MSXML anyway.

[1]

http://msdn.microsoft.com/library/de...netchapt09.asp
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #5

P: n/a
Alfred Taylor wrote:
You cannot. MSXML only supports scripting languages like JScript or
VBScript for extension functions.

Slightly confused here. You say no here, but it looks like below you say it
is possible through COM. Is that right?


MSXML allows JScript/VBScript extensions, where you can instantiate
ActiveX objects and I presume work with COM somehow.
I'm familiar with creating CCW in .NET, just not with the syntax of MSXML.
That's just VBScript or JScript.
I don't suppose you could provide a quick example of how you would use a COM
object for extension functions in MSXML? The other thing is, a lot of
people compare the speed improvements of MSXML over the .NET implementation,
however, not much is mentioned about memory. For my particular situation,
I'm more concerned with memory. How do the two implementations compare? Is
it neglible enough to not bother wasting my time testing MSXML?


I'm not sure what's the best here. You better try and measure.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #6

P: n/a
Alfred Taylor wrote:
You cannot. MSXML only supports scripting languages like JScript or
VBScript for extension functions.

Slightly confused here. You say no here, but it looks like below you say it
is possible through COM. Is that right?


MSXML allows JScript/VBScript extensions, where you can instantiate
ActiveX objects and I presume work with COM somehow.
I'm familiar with creating CCW in .NET, just not with the syntax of MSXML.
That's just VBScript or JScript.
I don't suppose you could provide a quick example of how you would use a COM
object for extension functions in MSXML? The other thing is, a lot of
people compare the speed improvements of MSXML over the .NET implementation,
however, not much is mentioned about memory. For my particular situation,
I'm more concerned with memory. How do the two implementations compare? Is
it neglible enough to not bother wasting my time testing MSXML?


I'm not sure what's the best here. You better try and measure.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.