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
829 Views

Similar Articles

[PageSpeed] 26

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:

Using CAsyncSocket in a non-UI thread
Hi, I know that this subject has been discussed before, but I couldn't find a simple way to create and use a CAsyncSocket in a non-UI Thead. Is it possible? Regards Haider Can't do it. Socket needs a GUI thread (message pump). AliR. "Haider" <hayder.tarik@gmail.com> wrote in message news:1140789379.972309.227760@t39g2000cwt.googlegroups.com... > Hi, > > I know that this subject has been discussed before, but I couldn't find > a simple way to create and use a CAsyncSocket in a non-UI Thead. Is it > possible? > > Regards > > Haider &g...

How to build a project in Visual C++.net developed in Visual C++ 6
Hi, I am Nageshwar. I have developed a project in VC++ 6.0 and OpenGL. I have installed VC++.net in my system. When I compile and build the same code in VC++.net environment, I am getting errors. I have used fstream.h to read and write to files. But this header file is showing errors in VC++.net. I have used iostrea.h header. This is also showing erros. I think I need to use a different version of headers. Please suggest me how to recover from these errors. Which header file I have use instead of fstream.h header? etc., Thanks for all who help me.. Awaiting an early response, Nageshwar ...

AVERAGEIF Function out there?
Is anybody out there aware of an "AVERAGEIF" function ?. I'm new to programming and have failed miserably trying to write it. Any help would be great. No need to write a function, you can use a combination of average and if as an example =AVERAGE(IF(Range=criteria,Range)) entered with ctrl + shift & enter Regards, Peo Sjoblom "davidad" wrote: > Is anybody out there aware of an "AVERAGEIF" function ?. > I'm new to programming and have failed miserably trying to > write it. Any help would be great. > davidad wrote: > Is any...

compiler errors using Groupwise developer kit
IHello World, I am trying to use the Groupwise Developer Kit within a VC++ application and keep getting this series of errors for one of the Groupwise include files: C:\Novell\ndk\novell-gwtoken-devel-2006.02.22-1windows\sample\Include\gwdll.h(260): error C2146: syntax error : missing ';' before identifier 'hszCommand' C:\Novell\ndk\novell-gwtoken-devel-2006.02.22-1windows\sample\Include\gwdll.h(331): error C2501: '_tagMAC_RETURNVAL::HSZ' : missing storage-class or type specifiers I don't think the include file really has anything wrong with it, so I must be ...

C: Drive documents and setting expansion
Whenever I, Right Click Start then click "Explore", I get an expansion of the my user ID folders. Now, I rarely us "Documents and Settings" and would like to have it expand differently. What do I need to change so that can happen?? Thanks.. Bruce A. Julseth wrote: > Whenever I, Right Click Start then click "Explore", I get an > expansion of the my user ID folders. Now, I rarely us "Documents and > Settings" and would like to have it expand differently. > > What do I need to change so that can happen?? 1. You could ...

How to PARSE using SQL?
I am trying to parse a string something like this... SELECT * from Table1 WHERE "Sarah" EXISTS ANYWHERE in "Name" Column. I would like the record to be selected if the Name column said "Sarah" and also if the name column said "xSarahx". I am doing this in MS Access 2003 and I realize that I could dump the entire table in a recordset but I am trying to avoid that if possible. Please help, Thanks Try: SELECT * from Table1 WHERE PersonName like "*Sarah*" So, you can use while cards. To find all names that start with the letter &quo...

Create timeline for 2500 B.C. to 100 B.C.?
Visio only allows me to create timeline for after 1900 AD. Can I use Visio to create a timeline for 2500 BC to 100 BC? Visio's Divided timeline has exactly what I need except I can not enter BC as the start and end time. And Visio always require end time to be greater than the start time. Any suggestion on how I can do this in Visio? You're not going to be able to use the timeline because the code is linked to the system clock (only goes back to 1900). You'll have to use the vanilla shapes that come with visio. Al "Little Black Sheep" <Little Bl...

Using outlook 2002 with word 2000
Can you use word 2000 as a email editor with outlook 2002? No. The versions must match. -- Jocelyn Fiorello MVP - Outlook *** Replies sent to my e-mail address will probably not be answered -- please reply only to the newsgroup to preserve the message thread. *** In news:02dd01c39e68$a3c91e80$a601280a@phx.gbl, dharvey wrote: > Can you use word 2000 as a email editor with outlook 2002? ...

Visual C++ to read Strings from Serial Port
Hi. I'm doing a project using Visual C++ to read data from Serial Port. My program needs to do *something* when it receives specific data. For eg, if the program receives "Alarm 1 Zone 4", it will do something. The data received will be variable in length. My questions: 1) Any recommendations for the serial Comm Class for Visual C++? 2) How can i compare the data i receive from serial to the specific messages i'm looking for, eg data types, size of data types, limitations & etc.? Thanks. Any comments are highly appreciated. Leng As far as the serial part goes, it i...

C++ : Is it lots harder than c# and VB
Hi everyone, I learned Java whilst at university and have taught myself c# and VB.net. I think I am ok at it. I was thinking, these languages will probably be bigger in the future so I better get ready for them. But then, I also realised that COM is still quite important and so is C++. So I thought I better just try and have a look at C++ and COM. And now I'm scared. So my question is - why does C++ look so much harder than c#? For example : 1. The methods all have really stupid names that are hard to descern a function from. 2. You need to think about pointers and cleaning up ...

Replying using a template
Is it possible to create a template to use when replying to a message? Basically, I want to open a message and reply to it using a standard reply template that will also contain the original message and the sender's details. I know that it is possible to set up a rule to send an automatic reply but I don't want the message sent automatically as there will be a number of different replies depending on the content of the original message and I would need to choose the template to use. Does anybody know how to do this? -----------------------------------------------------------------...

Import data using macro
Hi, how do you use excel to import a text file using a macro to do the work for you? I start by creating a new workbook. Then turn on the macro recorder and open that text file. (Try not to make errors--it can make clean up troublesome.) Then format the worksheet (headers/footers/page layout/filters,freeze panes) exactly the way you want. When you're done, turn off the macro recorder. Close the imported file and back to your other workbook. Insert a giant button from the forms toolbar on the first worksheet (with instructions). Then save it. Now go into the vbe and start tweakin...

Use Outlook to send to contacts in a query
Is there a way to set Outlook to send to contacts stored in a query (or a table) WITHOUT just importing them and doing it that way? I want to create a database, set Outlook to look in it, and have it send to contacts whose contact information will be listed in that database. Alan: Yes, there is a way. But have you explored, and rejected, storing contacts in Outlook and creating Outlook Distribution Lists? If you really need to store your contacts in Access, then you could use VBA code in your Access database to start Outlook and send and an email (or Mailitem as Outlook calls it). Y...

how i can use CEDitView member function
hi ,Can any one tell me that how i can use the CEditView member funcion ,if my VIEW CLASS IS DERIVED FROM CView instead of CEditView. for example void CTEST9View::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { CEdit& theEdit = GetEditCtrl(); ------------------ ------------------ } But I am unable to get Get GetEditCtrl() ,so what i should do Arbind Mr David if u do not want to want tell, don't tell but don't do like this. "Arbind" <arbindb_tech@rediffmail.com> wrote in message news:e$WzWnVYDHA.1492@TK2MSFTNGP12.phx.gbl... > hi ,Can any one ...

C#.net windows application
Since I am new to c#.net 2008 but I have worked a little with visual basic.net 2005, I have the following questions I would like to ask: 1. When I am looking at a .sln file that I will be maintaining a work, I can see there are lots of static void Main() methods in a file called program.cs throughout the solution in separate folderts. Can you tell me the purpose of this kind of code? Does this instantiate an object, is this a class libary member? 2. When running the C#.net 2008 professional version windows application, how do I know which 'main' method is being called? ...

MFC DLL Calling C# Assembly
I have been trying to get a simple mfc dll I wrote to add to numbers call a C# assembly. Here is a sample of my C++ code in my cpp file. extern "C" _declspec(dllexport) int Calc(int no1,int no2) { //result = no1 + no2; return MangedAdder(no1, no2); } #pragma managed #using <mscorlib.dll> #using <ControllerLibrary.dll> int MangedAdder(int a, int b) { ControllerLibrary::DLLController *t = new ControllerLibrary::DLLController(); return t->AddNumbers(a, b); } All I really need is an extern function in a mfc dll that calls a me...

Calculated Textbox using Invisible values
I have a calculated textbox with data source =Nz([A],0)+Nz([B],0)+Nz([C],0)+Nz([D],0). Any one or more of the textboxes B, C, D can be invisible. Everything works fine at data entry time. But when I recall the record for edit, the calculated field is #Error. I tried removing Nz([B],0)+Nz([C],0)+Nz([D],0) from the expression as B, C and D were invisible for the particular record to be editted and the error went away. Any thoughts as to how to get rid of the #Error when attempting to edit the record? Or what the problem is? Are invisible fields acceptable in calculated unbound tex...

Checkbox to allow Email Router to use user credentials is MISSING
I am using CRM 4.0 Online. We recently opted to use CRM Email Router for CRM Online for all email activities instead Outlook. I installed the CRM Email Router for CRM Online and tried configuing it. However, I could not find the checkbox [or the textboxes] to "Allow Email router to use my credentials to send and receive email on my behalf " in the Tools->Options (To set Personal Options) ->Email Tab. I only have the "Track Email" dropdown box, no check box that would allow me to enter the username and passsword. I made sure that the User's Ema...

Using system serial when creating a cash receipt using econnect 8.
I’m trying to insert a new unposted Cash receipt through “taRMCashReceiptInsert” class in econnect DLL. It requires the value of the document number of the new cash receipt . on the other hand if I insert a new cash receipt manually through Great Plains there’s a feature called automatic serial so that I don’t need to provide a document number for the new document, it’s generated automatically. For example if the last payment have the doc. Number payment00000001 the new payment will have document number payment00000002. So My question is how can I use the automatic serial feature of t...

Advancing the Date Function?
Hi, I'm just looking for a function that looks at the previous cell, into which I've typed the date (in MM-yy format), and then simply advances it to the next month (i.e I type in Jan-10, then the next cell automatically displays Feb-10, and the one after Mar-10, etc). Sorry if this seems a simple request. Thanks As long as you typed in a real date, the format won't matter to excel -- it will matter to you! But if you have June 1, 2010 in A1 (formatted to 06-10), you can use this in B1: =date(year(a1),month(a1)+1,1) and format it the way you like. Ruper...

sorting using macro
I created a series of macros that sort my spreadsheet by a different column heads as needed, and assigned them to buttons, so I can sort by those column when I want to by just clicking. It works fine, until I go and do something else in the sheet, like highlight a range of data for printing. After that, the macro fails and when I click debug, Below is one of the macros that sorts the column headed by names (names is in A1)Any ideas what I can do to fix this? Thanks in advance. Ross Sub sortnames() ' ' sortnames Macro ' Macro recorded 9/14/2005 by ross D ' ' S...

function not found in DLL
Specifically, at launching the main program, I get error window: “The procedure entry point ?function1@RTRTwrapper@@UAEXV$SomeStruct@M@@@Z could not be located in the DLL RTRT_dll.dll.” Basically, I have an interface class and a class that implements it built into a dll. In the example code below DLL_IMPORT_EXPORT is either _declspec(dllexport) at the DLL project, and _declspec(dllimport) when the DLL is used by the main project. Class DLL_IMPORT_EXPORT MyInterface { Virtual void function1(int param) = 0; Virtual void function2(int param) = 0; }; Class DLL_IMPORT_EXPORT MyClass : pu...

TSQL replacements for Access Functions
Great article, wish someone had given me this a decade ago! http://www.databasejournal.com/features/msaccess/article.php/3865076/article.htm Thanks for sharing that link. Danny does a good job of summarizing. "a a r o n _ k e m p f" <aaron_kempf@Hotmail.com> wrote in message news:81d76203-063c-4e73-9973-b3d2a893c654@v20g2000prb.googlegroups.com... > Great article, wish someone had given me this a decade ago! > > http://www.databasejournal.com/features/msaccess/article.php/3865076/article.htm > "a a r o n _ k e m p f" <aaron_kempf@Ho...

Type Casting in C and C++
Hello NG As an old style programmer I've been casting values with the C-syntax like: double dVal=3.14; float fVal = (float) dVal; but now I've been told that the C++ syntax should do a better job float fVal = static_cast <float>(dVal); for some reason. Is this true? Will the C++ compiler really generate different (better?) code or is it simply more writing I have to do? Thanx Richie >As an old style programmer I've been casting values with the C-syntax like: > >double dVal=3.14; >float fVal = (float) dVal; > >but now I've been told that the C+...

Find Function
I would like to find the second occurence of a specific alphanumeric character in a cell. For example, if cell A1 contains "BOBBY" what would be the formula for finding the second occurence of the letter "B". Thank you advance for your assistance. Greatly appreciated =FIND("#",SUBSTITUTE(A1,"B","#",2)) Replace # by another symbol if it can be part of your text -- Kind regards, Niek Otten Microsoft MVP - Excel "SJT" <SJT@discussions.microsoft.com> wrote in message news:70B9153E-4351-4983-96D5-8870C633...