C# extension functions using MSXML?

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


0
omyek (4)
6/15/2004 2:42:44 PM
dotnet.xml 7266 articles. 0 followers. Follow

3 Replies
974 Views

Similar Articles

[PageSpeed] 22

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/default.asp?url=/library/en-us/dnpag/html/scalenetchapt09.asp

-- 
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
0
Oleg
6/15/2004 4:24:04 PM
Hi Oleg,

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

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:<exq2MyuUEHA.2484@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/default.asp?url=/library/en-us/dnpag/html/scalenetchapt09.asp
>
> -- 
> Oleg Tkachenko [XML MVP]
> http://blog.tkachenko.com


0
omyek (4)
6/15/2004 4:41:14 PM
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
0
Oleg
6/16/2004 9:59:23 AM
Reply:

Similar Artilces:

Can I use the named range in the following way?
Hi all, I defined a cell named range: Let's call the cells A1 to A5 to be "trytry". Then in another cell, I enter "sum(trytry)", I will be able to get correct result. But how do I manipulate the named cell range as an array variable? For example, if I want multiply each element of "trytry" by 3 and put the results in another column vector(array), is it possible? More generally, I am looking for ways to do calculation in Excel more intuitively. Instead of addressing cells by row number and column letters, I hope I can address the cells by variable nam...

Using Multidimensional Array
I am using multidimensional array in my function. dim aReturnValue() iIndexValue = 0 If iOccurrence > 0 Then bStringFound = True ' Prepare the return value ReDim Preserve aReturnValue(iIndexValue, 3) aReturnValue(iIndexValue,0) = sMatchedValue aReturnValue(iIndexValue,1) = iLineCount+1 aReturnValue(iIndexValue,2) = iOccurrence aReturnValue(iIndexValue,3) = sListOfMatchFoundItems iIndexValue = iIndexValue + 1 End If Problem is I am getting subscript out of range in ReDim Preserve aReturnValue(iIndexValue, 3) I checked it on the net... I came to know that When usi...

Using Combo Box selections to automatically populate fields
I have a form for data entry, and then I'm basically copying this form and re-tooling it for editing and reviewing. I would like for the user to be able to select pond name and then date sampled (or vice versa). The pond name is to be selected from a combo box. As for the date, I'm not sure what's the best way to approach this. Put the date in a combo box, too? There's another database I currently use (made by someone else) that has a calendar pop up and you can select the date and it automatically enters it into the field. I like this... But I don't kn...

Using Outlook 2003 in terminal server with Microsoft Exchange 2010
I recently installed Exchange Server 2010 on my business network. After doing so, a few itmes are not functioning properly in the Terminal Server mode. When deleting a message, it does not go away until the user clicks on either another message or scolls down to another message. When arranging a list of messages in other oreders rather than by receive date, a user can not use the bar to move to any point in the list. The list just reverts back to its original position. Documentation on Exchange server 2010 is very difficult to find, at least it is for me. Can you help? -- ...

cannot use reply or forward
Hi can anyone tell me why i cannot use the reply or forward buttopn? when i go to reply or forward the computer freezes up the curser will not move i have to get out of the program and then restart outlook and it will work one time and then when i want to reply to another e-mail it will do tlhe same tlhin g lagan . Can you help me? -- kzicheck What version of Outlook are you using? Does this happen even if you start Outlook in Safe Mode? (hold down CTRL while you click the icon) See if this helps: http://www.officeforlawyers.com/outlook/tsol.html#safe -- -Ben- Ben M. Sch...

Anyone here use Trusted Keywords?
I tell you our department got 100-300 spam emails a day, and this was being sent to nonpublished addresses! I don't know how they got our addresses, but they did. Our IT guy who is a smart fellow, spent some time on the internet to come up with something tht would work for us, and he found Spam CSI - Crime Scene Investigator. I don't know where he got it from but he says its all over google. Anyway, this thing does a million tricks, but the one we like the most is that we can set it up to look for a special keyword in the email, and if it finds it, it lets it go through. If it d...

Using Exchange 2003 Deployment Tools (incl. ADC) for 2000 upgrade
After researching and testing various migration strategies for upgrading our organization from Exchange 5.5 on Win2k to Exchange 2003 on Win2k, it seems that the best method will be to first upgrade our various sites to Exchange 2000, then consolidate the users to a fewer number of Exchange 2003 servers. I'm interested in getting feedback on this strategy. I'll explain our situation further We have 21 sites in our Exchange organization, one each per regional office (though some offices do not have an Exchange server). Given that we only have 450 users in our org, we want to consolidat...

Can i use a outlook 2003 to be a client of Exchange Server 4.0
I fail to check my name,why ? who can tell me? thanks! i hope someone just tell me it can or can't. "tongwawa" <unregistered@163.com> write messages news:uxxHUExuDHA.2340@TK2MSFTNGP12.phx.gbl... > I fail to check my name,why ? who can tell me? thanks! > > tongwawa wrote: > i hope someone just tell me it can or can't. > "tongwawa" <unregistered@163.com> write messages > news:uxxHUExuDHA.2340@TK2MSFTNGP12.phx.gbl... > >>I fail to check my name,why ? who can tell me? thanks! >> >> > > > Make sure yo...

In copied worksheet, embedded chart uses data fm orig
When I copy a worksheet, I want the embedded chart to automatically use data from the new worksheet, Instead, it uses data from the original worksheet. So I have to edit each data series in the chart everytime I create a new worksheet by copying an old one. Example: worksheet displaying hours worked that week. When I copy the sheet to start a new week, the embedded chart is displaying data from last week. It seems you are making the new worksheet with Copy & Paste. Try this instead: click on the tab of original sheet (let's call it Sheet1), hold the CTRL key down and drag the tab ...

Set date field year to 2005
Hi there, I have a spreadsheet of dates, EG: '10/09/1983', '03/08/1985'. I need to change these all to be in the year 2005, so '10/09/1983' becomes '10/09/2005'. I assumed it would be a case of just doing a custom format DD MMMM 2005 but this doesn't work. Is there an easy worksheet function to do this or will I need to write a macro? Cheers, Chris If it's a one timer you can use formulas =DATE(2005,MONTH(A1),Day(A1)) will take the date in A1 and change the year to 2005 then you can just copy and paste special as values over the old dates, finally...

How to use "mailto" for more than one person?
When one puts an email address in this format: mailto:emailaddress@something.com, as everyone usu. knows, when a person clicks on that link, a new compose window opens up and the addressee is automaticlaly dumped into the TO box. Is there a way to put a link like this but with the address of more than one person? I tried: mailto:emailaddress1@something.com,emailaddress2@something.com, and <mailto:emailaddress1@something.com, emailaddress2@something.com> but one address seems to always get bumped off. Thanks. :oD Do you have the option checked to allow commas as address separators?...

Restoring a mailbox using W2k Backup
Hi, I have accidentally deleted a mailbox from my Exchange 5.5 server(running W2K server) and need restore it from backup. I am trying to follow the instructions in Article 163713. I have installed Exchange Server 5.5 on another Windows 2000 server and have created a new site with the same site and organization name as the original server. I go into Windows 2000 backup and try to restore it but I cannot select the other server to restore to... I can only select the original server. Am I doing somthing wrong??? Can you please get back to me urgently on this? Thanks in advance. Kind Rega...

Left Function
I am trying to pull certain characters based on a criteria for the third position character. In Column A, I could have a code such as BB11 or a Code such as BMR2. If the third position character is a number then I only want to pull the first 2 digits BB but if the third position character is a letter, then I would like to pull the first 3 characters BMR. Can anyone help? -- AJ Try this =LEFT(A1,3-(ISNUMBER(MID(A1,3,1)+0))) -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still suffici...

Delay Send Using Outlook 2003
When using Delay Send in Outlook 2003 Client connected to Exchange server 2000; The e-mail will wait in the Outbox until its pre-set delivery time. The E-mail will send, but the e-mail never makes it to the reciepient's Inbox. Has anyone ever run into this situation, if so, inform of a solution. it's never happened to me, but I've seen reports of it. I'm not sure what the resolution was - you might want to Google for older posts about it (groups.Google.com) -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for W...

How to do flush in socket programming in C++
Hi, How can I do a something like flush after calling 'send' method in CSocket class?? this because we have a Java server running in the other side which expect a flush before it responds. Pls help ...

Trim function in a query for making labels
I have an Accress database that was created in Access 2000 (or earlier) ... newly installed Access 2007. I am trying to print mailing labels -- that part works as expected, but I am getting an "Enter Parameter Value" box before the labels display, and when they do display there is Error on the lines requiring Trim ... I have no idea what I am supposed to input into that box. Can someone enlighten me, please? Thanks for your help. -- Jan Your References collection is probably messed up. References problems can be caused by differences in either the location or file vers...

Incorrect function GetInputCount Error
Getting Incorrect function GetInputCount when launching RMS POS when we enable Pinpad. Any ideas other than reinstall? -- Jason Clements Pinch A Penny ===================================================== ===================================================== Starting working fine as so as we hooked up the pinpad. Never seen this error before! ===================================================== ===================================================== "Jasoncleme" wrote: > Getting Incorrect function GetInputCount when launching RMS POS when we > enable Pinpad. Any idea...

Multi-use with excel 97 possible??
Hello all, I have an excel 97 worksheet. It must be possible that several people can work at the same time in this sheet. Is this possible?? Or do I need something else to arrange this? Thanks and Regards, Anneke You can share the workbook (tools|share) (well, if it's stored in a central location that all can get to). But there's lots of things that can't be done with shared workbooks. See Excel's help for details. Personally, I try to just let one user work on the workbook at a time. There are other applications that may be better--maybe a real database program (Access...

Multiple Profiles Using Terminal Server
Does anyone know if anything has changed around using multiple profiles with Terminal Server? Last time I checked you can only use CRM Outlook using the user that installed the Outlook Client. Is this still true? With CRM 4.0 this has changed. In fact, there were ways to configure it with 3.0 as well. But, 4.0 has a seperate "config" step for the client that makes this a lot easier. -- Matt Parks MVP - Dynamics CRM "Scottie" <Scottie@discussions.microsoft.com> wrote in message news:0C0282BD-76B4-41E1-BD9D-6C24C6984FEB@microsoft.com... Does anyone know if ...

how can I use outlook to manage all of my email accounts?
I want to use outlook to check all my various email accounts - but still keep the messages separated by account - is this possible? and is there a tutorial some place to help me with some basic outlook use questions? You can use the Rules Wizard to sort items based on incoming account. "Angel" <Angel@discussions.microsoft.com> wrote in message news:87B6535F-069C-4D64-A894-D5D81E9959CB@microsoft.com... >I want to use outlook to check all my various email accounts - but still >keep > the messages separated by account - is this possible? and is there a > tutoria...

How do I create an A3 size document using Windows 7
A3 is not listed in the pre-set schedule of document sizes in Windows 7 (unlike previous versions of Windows). How do I create such a document using Windows 7? Does your printer support A3? Word/Windows will display the paper sizes supported by the default (or currently active) printer. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "A3 documents in Windows 7" <A3 documents in Windows 7@discussions.microsoft.com> wrote in message news:F2647F06-5560-41A6-9C2F-462E6198C989@microsoft.com... > A3 is ...

Office 2003 Missing File:C:\SKU011:CAB trying to update to Office
Somehow my source file C:\SKU 011.cab for Office 2003 is missing & I can't install Office 2007. How can this be overcome? If you do not have the installation cd and want to solve this issue follow these steps: (works most of the time with all sku.cab files) 1. Click on start==>run==>type "excel /s" without quotations and click ok. 2. Once Excel is up in safe mode with the error message in front, hold down ctrl+Alt+Delete keys on your keyboard to bring the task manager up. 3. Click on the processes tab==>look for msiexec.exe (only the one next to your...

Which function should I use?Thanks!
SHGetFolderPath() and SHGetFolderLocation() function is similar.What is the differences between them? Which function should I use? Thanks! fiveight wrote: > SHGetFolderPath() and SHGetFolderLocation() function is similar.What is the > differences between them? Which function should I use? Thanks! fiveight: Isn't it SHGetSpecialFolderPath() and SHGetSpecialFolderLocation()? SHGetSpecialFolderPath() is easier to use, but it is not on all systems. In fact, I just discovered that it does not work on NT, even though my NT test machine has SP6 and IE4 SP2 (which I thought mean...

Address Finder function doesn't work
Address Finder function, in Outlook, doesn't work correctly. Instead of taking me, via IE's browser, to Microsoft's Map website I find myself at the Homepage for Microsoft's Office products. How do I fix this to get it to go back to where it used to? ...

more on VBA function name change
I thought I'd start a new thread since I haven't received any replies to my first one... To recap: I've declared a function in a module using mixed case: Function TMDE_Category (FormName As Form) I noticed recently that it appeared in the module as Function tmde_category(FormName As Form) I changed it back to the mixed case declaration, saved the module, exited the app, reopened it and looked. The function had changed back to the all lowercase declaration. Things I've tried since the original post: Using the databse documenter, I selected all ob...