In the txt file that you attached have 3 records, so you need 3 rows?","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"129","kudosSumWeight":0,"postTime":"2016-08-30T21:03:53.097-07:00","lastPublishTime":"2016-08-30T21:03:53.097-07:00","metrics":{"__typename":"MessageMetrics","views":4851},"visibilityScope":"PUBLIC","placeholder":false,"showMoveIndicator":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"MessageEdge","cursor":"MjUuNHwyLjF8b3wzfDE0OjAsMzk6MXwx","node":{"__ref":"ForumReplyMessage:message:126048"}}]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"ModerationData:moderation_data:126048":{"__typename":"ModerationData","id":"moderation_data:126048","status":"APPROVED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"ForumReplyMessage:message:126048":{"__typename":"ForumReplyMessage","uid":126048,"id":"message:126048","entityType":"FORUM_REPLY","eventPath":"category:soapui-os-community/community:nwkab66374board:SoapUI_OS/message:125901/message:126048","revisionNum":1,"author":{"__ref":"User:user:69059"},"readOnly":false,"repliesCount":4,"depth":2,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:SoapUI_OS"},"parent":{"__ref":"ForumReplyMessage:message:126025"},"conversation":{"__ref":"Conversation:conversation:125901"},"subject":"Re: Groovy iterate Nodes with XMLHolder response -soapui","moderationData":{"__ref":"ModerationData:moderation_data:126048"},"body":"
Yes,
The attached file is response from previous step and next step is groovy to read and write in Excel sheet.
I am using Xpath and able to write when one record, but i need to write all 3 records.
Thanks
Babu
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"208","kudosSumWeight":0,"postTime":"2016-08-31T03:44:03.834-07:00","lastPublishTime":"2016-08-31T03:44:03.834-07:00","metrics":{"__typename":"MessageMetrics","views":4836},"visibilityScope":"PUBLIC","placeholder":false,"showMoveIndicator":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"MessageEdge","cursor":"MjUuNHwyLjF8b3wxfDE0OjAsMzk6MXwx","node":{"__ref":"ForumReplyMessage:message:126065"}}]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"ModerationData:moderation_data:126065":{"__typename":"ModerationData","id":"moderation_data:126065","status":"APPROVED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"ForumReplyMessage:message:126065":{"__typename":"ForumReplyMessage","author":{"__ref":"User:user:21201"},"id":"message:126065","entityType":"FORUM_REPLY","eventPath":"category:soapui-os-community/community:nwkab66374board:SoapUI_OS/message:125901/message:126065","revisionNum":1,"uid":126065,"depth":3,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:SoapUI_OS"},"parent":{"__ref":"ForumReplyMessage:message:126048"},"conversation":{"__ref":"Conversation:conversation:125901"},"subject":"Re: Groovy iterate Nodes with XMLHolder response -soapui","moderationData":{"__ref":"ModerationData:moderation_data:126065"},"body":"Will there be any other data in the excel file?Here is the script which reads your data and put it into list of StateInfo objects. All you need to do is loop thru the list of stateInfos and put it into excel. Hope you should be able to do it.
\n\n
import groovy.xml.*\n//Business Model class\nclass StateInfo {\n def city\n def state\n def zip\n def areaCode\n def timeZone\n}\n\ndef xmlString = '''<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n <soap:Body>\n <GetInfoByStateResponse xmlns=\"http://www.webserviceX.NET\">\n <GetInfoByStateResult>\n <NewDataSet xmlns=\"\">\n <Table>\n <CITY>Wharton</CITY>\n <STATE>TX</STATE>\n <ZIP>77488</ZIP>\n <AREA_CODE>409</AREA_CODE>\n <TIME_ZONE>C</TIME_ZONE>\n </Table>\n <Table>\n <CITY>Wheeler</CITY>\n <STATE>TX</STATE>\n <ZIP>79096</ZIP>\n <AREA_CODE>806</AREA_CODE>\n <TIME_ZONE>C</TIME_ZONE>\n </Table>\n <Table>\n <CITY>Wheelock</CITY>\n <STATE>TX</STATE>\n <ZIP>77882</ZIP>\n <AREA_CODE>409</AREA_CODE>\n <TIME_ZONE>C</TIME_ZONE>\n </Table>\n </NewDataSet>\n </GetInfoByStateResult>\n </GetInfoByStateResponse>\n </soap:Body>\n</soap:Envelope>'''\n\n//println xmlString\nList<StateInfo> stateInfos = new ArrayList<>()\ndef slurper = new XmlSlurper().parseText(xmlString)\ndef tables = slurper.Body.GetInfoByStateResponse.GetInfoByStateResult.NewDataSet.Table\ntables.each { table ->\n StateInfo stateInfo = new StateInfo()\n stateInfo.city = table.CITY\n stateInfo.state = table.STATE\n stateInfo.zip = table.ZIP\n stateInfo.areaCode = table.AREA_CODE\n stateInfo.timeZone = table.TIME_ZONE\n stateInfos << stateInfo\n}\n\nassert stateInfos.size() == 3","body@stripHtml({\"removeProcessingText\":true,\"removeSpoilerMarkup\":true,\"removeTocMarkup\":true,\"truncateLength\":200})@stringLength":"208","postTime":"2016-08-31T08:24:20.371-07:00","lastPublishTime":"2016-08-31T08:24:20.371-07:00","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"attachments":{"__typename":"AttachmentConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"solution":true,"metrics":{"__typename":"MessageMetrics","views":4793},"placeholder":false,"showMoveIndicator":false,"originalMessageForPlaceholder":null,"videos":{"__typename":"VideoConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"isEscalated":null,"readOnly":false,"customFields":[]},"ModerationData:moderation_data:126081":{"__typename":"ModerationData","id":"moderation_data:126081","status":"APPROVED","rejectReason":null},"AcceptedSolutionMessage:message:126081":{"__typename":"AcceptedSolutionMessage","author":{"__ref":"User:user:69059"},"id":"message:126081","entityType":"FORUM_REPLY","eventPath":"category:soapui-os-community/community:nwkab66374board:SoapUI_OS/message:125901/message:126081","revisionNum":1,"uid":126081,"depth":6,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:SoapUI_OS"},"parent":{"__ref":"AcceptedSolutionMessage:message:126072"},"conversation":{"__ref":"Conversation:conversation:125901"},"subject":"Re: Groovy iterate Nodes with XMLHolder response -soapui","moderationData":{"__ref":"ModerationData:moderation_data:126081"},"body":"
thanks for you time and efforts.
","body@stripHtml({\"removeProcessingText\":true,\"removeSpoilerMarkup\":true,\"removeTocMarkup\":true,\"truncateLength\":200})@stringLength":"34","postTime":"2016-08-31T08:45:31.958-07:00","lastPublishTime":"2016-08-31T08:45:31.958-07:00","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"attachments":{"__typename":"AttachmentConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"solution":true,"metrics":{"__typename":"MessageMetrics","views":4883},"placeholder":false,"showMoveIndicator":false,"originalMessageForPlaceholder":null,"videos":{"__typename":"VideoConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"isEscalated":null,"customFields":[]},"CachedAsset:text:en_US-shared/client/components/users/UserAvatar-1749758931278":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserAvatar-1749758931278","value":{"altText":"{login}'s avatar","altTextGeneric":"User's avatar"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/ranks/UserRankLabel-1749758931278":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/ranks/UserRankLabel-1749758931278","value":{"altTitle":"Icon for {rankName} rank"},"localOverride":false},"CachedAsset:text:en_US-components/common/ExternalLinkWarningModal-1749758931278":{"__typename":"CachedAsset","id":"text:en_US-components/common/ExternalLinkWarningModal-1749758931278","value":{"title":"Leaving the Community","description":"You're about to leave this site and navigate to an external domain. Are you sure you want to continue?","action.submit":"Continue","action.cancel":"Go Back"},"localOverride":false},"CachedAsset:text:en_US-components/attachments/AttachmentView/AttachmentViewChip-1749758931278":{"__typename":"CachedAsset","id":"text:en_US-components/attachments/AttachmentView/AttachmentViewChip-1749758931278","value":{"errorTitle":"Failed!","previewFile":"Preview File","downloadFile":"Download File {name}","removeFile":"Remove File {name}","errorBadExtension":"This file does not have a valid extension. \"{extensions}\" are the valid extensions.","errorFileEmpty":"This file is empty or does not exist.","errorTooLarge":"The maximum file size is: {maxFileSize}.","errorTooMany":"Too many attachments. The maximum number of attachments per message is: {maxAttachmentCount, number, integer}.","errorDuplicate":"This file is already attached."},"localOverride":false}}}},"page":"/forums/ForumMessagePage/ForumMessagePage","query":{"boardId":"soapui_os","messageSubject":"groovy-iterate-nodes-with-xmlholder-response--soapui","messageId":"125901"},"buildId":"3XH0qYWYCnEYycuN5W4S8","runtimeConfig":{"buildInformationVisible":false,"logLevelApp":"info","logLevelMetrics":"info","surveysEnabled":true,"openTelemetry":{"clientEnabled":false,"configName":"smartbear","serviceVersion":"25.4.0","universe":"prod","collector":"http://localhost:4318","logLevel":"error","routeChangeAllowedTime":"5000","headers":"","enableDiagnostic":"false","maxAttributeValueLength":"4095"},"apolloDevToolsEnabled":false,"quiltLazyLoadThreshold":"3"},"isFallback":false,"isExperimentalCompile":false,"dynamicIds":["components_seo_QAPageSchema","components_community_Navbar_NavbarWidget","components_community_Breadcrumb_BreadcrumbWidget","components_messages_TopicWithThreadedReplyListWidget","components_messages_MessageListForNodeByRecentActivityWidget","components_messages_RelatedContentWidget","components_customComponent_CustomComponent","components_messages_MessageView_MessageViewStandard","components_messages_ThreadedReplyList","components_messages_EscalatedMessageBanner","shared_client_components_common_List_UnstyledList","components_messages_MessageView","shared_client_components_common_Pager_PagerLoadMore","components_messages_MessageView_MessageViewInline","components_customComponent_CustomComponentContent_TemplateContent","shared_client_components_common_List_UnwrappedList","components_attachments_AttachmentView","components_attachments_AttachmentView_AttachmentViewChip"],"appGip":true,"scriptLoader":[]}