09-29-04 08: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
>
>
>
[ Post a follow-up to this message ]
|