Passing a node with xdExtension

D

djasek

I want to call a C# function from a conditional formatting expression
with xdExtension, but I want to pass an XML node as an argument.
I tried to do this:
My C# function declaration looks like:
bool foo(IXMLDOMNode bar)

and when I call it like this:
xdExtension:foo(.)

I get an invalid cast error. Anyone know how to do this?

Thanks,
-Dan
 
S

S.Y.M. Wong-A-Ton

If you want to use an XML node in code, you can pass the XPath expression to
the XML node as a string to your function "foo", and then retrieve the node
in code by using a selectSingleNode on the DOM with the string passed.
 
D

djasek

The problem is getting the correct row in a repeating section.

I could do some contortions with count() and previous-sibling to figure
it out. But it seems like a lot more work than it should be.

When I change foo's argument to an object and debug; the node is coming
in as a System.__ComObject. I don't know what that means, but it seems
there should be some way to extract the calling node or a passed node
in managed code without resorting to painful XPATH hackery.

-Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top