Home Page › Forums › BizTalk 2004 – BizTalk 2010 › xpath, I don’t get it…
- This topic has 2 replies, 1 voice, and was last updated 9 years, 2 months ago by
community-content.
-
AuthorPosts
-
-
March 4, 2008 at 12:53 AM #19014
I have a problem with xpath.
Have tried several solutions found on the web, but still no working solution.The problem is this:
I have an XML-file that looks like this:
<?xml version=”1.0″?>
<OphalenOverzichtNieuweAanvragenResponse xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns=”http://Aansluitingen.DataContracts/2007/12“>
<Aantalaanvragen>3</Aantalaanvragen>
<Tijdstipverwerking>2008-03-04 09-10-46</Tijdstipverwerking>
<Aanvraagcodes>
<ResponseAanvraagCodes>
<Provincie>ZHL</Provincie>
<AanvraagJaar>2007</AanvraagJaar>
<AanvraagCombivolgnummer>01659</AanvraagCombivolgnummer>
<Aanvraagcode>zhl07.01659</Aanvraagcode>
</ResponseAanvraagCodes>
<ResponseAanvraagCodes>
<Provincie>ZHL</Provincie>
<AanvraagJaar>2007</AanvraagJaar>
<AanvraagCombivolgnummer>02411</AanvraagCombivolgnummer>
<Aanvraagcode>zhl07.02411</Aanvraagcode>
</ResponseAanvraagCodes>
<ResponseAanvraagCodes>
<Provincie>ZHL</Provincie>
<AanvraagJaar>2007</AanvraagJaar>
<AanvraagCombivolgnummer>02639</AanvraagCombivolgnummer>
<Aanvraagcode>zhl07.02639</Aanvraagcode>
</ResponseAanvraagCodes>
</Aanvraagcodes>
</OphalenOverzichtNieuweAanvragenResponse>The number of ResponseAanvraagCodes can chance per file.
I need to get, in a loop in a orchestration, to get the value of each item Aanvraagcode, for instance “zhl07.01659”How do I fix this problem?
Any help is welcome
-
March 4, 2008 at 7:06 AM #19017
I am trying it myself and at this moment I use the following xpath query:
xPathStatement = “string(/*[local-name()=’OphalenOverzichtNieuweAanvragenResponse’]/*[local-name()=’Aanvraagcodes’]/*[local-name()=’ResponseAanvraagCodes’]/*[local-name()=’Aanvraagcode’])”;
iAanvraagCode = xpath(msgOphalenOverzichtNieuweAanvragenResponse,xPathStatement);This means that I get 3 times the same Aanvraagcode-value “zhl07.01659”, being the first one in the XML-file.
What should I chance to get all the 3 different Aanvraagcode-values?
-
March 5, 2008 at 6:05 AM #19020
I have figured it out.
xPathStatement = “string(/*[local-name()=’OphalenOverzichtNieuweAanvragenResponse’]/*[local-name()=’Aanvraagcodes’]/*[local-name()=’ResponseAanvraagCodes’][i]/*[local-name()=’Aanvraagcode’])”;
iAanvraagCode = xpath(msgOphalenOverzichtNieuweAanvragenResponse,xPathStatement);Doesn’t do the trick.
xPathStatement = “string(/*[local-name()=’OphalenOverzichtNieuweAanvragenResponse’]/*[local-name()=’Aanvraagcodes’]/*[local-name()=’ResponseAanvraagCodes’][” + System.Convert.ToString(i) + “]/*[local-name()=’Aanvraagcode’])”;
iAanvraagCode = xpath(msgOphalenOverzichtNieuweAanvragenResponse,xPathStatement);Works fine for me!
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.