BizTalk Server General - Custom .NET Class for Business Rule Fact

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > September 2004 > Custom .NET Class for Business Rule Fact





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Custom .NET Class for Business Rule Fact
NickH2472

2004-09-28, 5:52 pm

I am looking to write a custom .NET class to provide a mechanism of returning
the number of characters in an XML element.

I have created a simple method named Length(), with one parameter 'sString'
of type string. However, when I attempt to use an element in my XML document
I receive the following error:

"The definition <XPath to element name> is not compatible with the argument
type (String)"

However If I pass an attribute to the method everything works as expected.
Can anyone advise what parameter type I should be using in my method? Note:
The element in question has a base datatype of 'xs:string', Content Type of
'SimpleContent' and a Derived By value of 'Extension'.

An example of my XML document structure is below.

Regards, Nick


Example:
<order>
<orderLines>
<line>
<ProductCode error="This is some error text">HL1450</ProductCode>
</line>
</orderLines>
</order>

/order/orderLines/line/ProductCode <-- Will not work as an input to the method
/order/orderLines/line/ProductCode/@error <-- Will work as an input to the
method



Matt Milner

2004-09-29, 3:06 am

Try TypedXmlDocument, this should allow you to get at the node pretty easily
and work with it in the DOM to get the inner text of the node.

matt


"NickH2472" <NickH2472@discussions.microsoft.com> wrote in message
news:B218AB49-9E52-427F-8182-0CFD29C4F68E@microsoft.com...
>I am looking to write a custom .NET class to provide a mechanism of
>returning
> the number of characters in an XML element.
>
> I have created a simple method named Length(), with one parameter
> 'sString'
> of type string. However, when I attempt to use an element in my XML
> document
> I receive the following error:
>
> "The definition <XPath to element name> is not compatible with the
> argument
> type (String)"
>
> However If I pass an attribute to the method everything works as expected.
> Can anyone advise what parameter type I should be using in my method?
> Note:
> The element in question has a base datatype of 'xs:string', Content Type
> of
> 'SimpleContent' and a Derived By value of 'Extension'.
>
> An example of my XML document structure is below.
>
> Regards, Nick
>
>
> Example:
> <order>
> <orderLines>
> <line>
> <ProductCode error="This is some error
> text">HL1450</ProductCode>
> </line>
> </orderLines>
> </order>
>
> /order/orderLines/line/ProductCode <-- Will not work as an input to the
> method
> /order/orderLines/line/ProductCode/@error <-- Will work as an input to the
> method
>
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com