Hello,
I'm trying to get a count of nodes using xpath inside a biztalk expression editor. Please let me know if there's a better forum in which to post this.
I've tried many different approaches and I still keep getting 0. Also, I tried putting this expression in xslt to test as I've used that some before but it didn't like the syntax regarding the namespace. Is there another tool to use to test this expression against an xml file without using xslt? I've only done xpath inside of xslt and a little in querying a sql server xml datatype.
intRecordCount = System.Convert.ToInt32(xpath("count(/*[local-name()='TypedPolling' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='])"));
intRecordCount = System.Convert.ToInt32(xpath("count(/*[local-name()='TypedPolling' and namespace-uri()=']/*[local-name()='//TypedPollingResultSet0/TypedPollingResultSet0' and namespace-uri()='])"));
intRecordCount = System.Convert.ToInt32(xpath("count(//TypedPolling/TypedPollingResultSet0/TypedPollingResultSet0 and namespace-uri()='
intRecordCount = (System.Int32)(xpath("count(/*[local-name()='TypedPolling' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='])"));
intRecordCount = (System.Int32)(xpath("count(/*[local-name()='TypedPolling' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='])"));
Thanks for any help!
my xml trying to get back a count of 2:
I'm trying to get a count of nodes using xpath inside a biztalk expression editor. Please let me know if there's a better forum in which to post this.
I've tried many different approaches and I still keep getting 0. Also, I tried putting this expression in xslt to test as I've used that some before but it didn't like the syntax regarding the namespace. Is there another tool to use to test this expression against an xml file without using xslt? I've only done xpath inside of xslt and a little in querying a sql server xml datatype.
intRecordCount = System.Convert.ToInt32(xpath("count(/*[local-name()='TypedPolling' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='])"));
intRecordCount = System.Convert.ToInt32(xpath("count(/*[local-name()='TypedPolling' and namespace-uri()=']/*[local-name()='//TypedPollingResultSet0/TypedPollingResultSet0' and namespace-uri()='])"));
intRecordCount = System.Convert.ToInt32(xpath("count(//TypedPolling/TypedPollingResultSet0/TypedPollingResultSet0 and namespace-uri()='
intRecordCount = (System.Int32)(xpath("count(/*[local-name()='TypedPolling' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='])"));
intRecordCount = (System.Int32)(xpath("count(/*[local-name()='TypedPolling' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()=']/*[local-name()='TypedPollingResultSet0' and namespace-uri()='])"));
Thanks for any help!
my xml trying to get back a count of 2:
Code:
<TypedPolling xmlns="[URL unfurl="true"]http://schemas.microsoft.com/Sql/2008/05/TypedPolling/PracApptsGet">[/URL]
<TypedPollingResultSet0>
<TypedPollingResultSet0>
<practitionerId>10243</practitionerId>
<ProvNum>038232</ProvNum>
<InstitutionID>352435</InstitutionID>
<HOSP>AAU</HOSP>
<PractitionerAppointmentRecID>100000</PractitionerAppointmentRecID>
<CreatedOn>2014-04-27T00:00:00Z</CreatedOn>
<ChangedOn>2014-04-27T00:00:00Z</ChangedOn>
<operation>2</operation>
</TypedPollingResultSet0>
<TypedPollingResultSet0>
<practitionerId>10243</practitionerId>
<ProvNum>038232</ProvNum>
<InstitutionID>353080</InstitutionID>
<HOSP>PCH-1</HOSP>
<PractitionerAppointmentRecID>110533</PractitionerAppointmentRecID>
<CreatedOn>2014-04-26T11:02:49.573Z</CreatedOn>
<ChangedOn>2014-04-26T12:54:48.987Z</ChangedOn>
<dateFrom>2014-04-01T00:00:00Z</dateFrom>
<operation>2</operation>
</TypedPollingResultSet0>
</TypedPollingResultSet0>
</TypedPolling>