Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 3.74 KB | None | 0 0
  1. /* Hello World in Groovy */
  2. def text = '''
  3. <root>
  4.  <row>
  5.    <BusinessPartner>9980000000</BusinessPartner>
  6.    <BPIdentificationType>HCM001</BPIdentificationType>
  7.    <BPIdentificationNumber>RF000001</BPIdentificationNumber>
  8.    <BPIdnNmbrIssuingInstitute></BPIdnNmbrIssuingInstitute>
  9.    <BPIdentificationEntryDate></BPIdentificationEntryDate>
  10.    <Country></Country>
  11.    <Region></Region>
  12.    <ValidityStartDate></ValidityStartDate>
  13.    <ValidityEndDate>31-12-99 00:00</ValidityEndDate>
  14.    <AuthorizationGroup></AuthorizationGroup>
  15.  </row>
  16.  <row>
  17.    <BusinessPartner>9980000001</BusinessPartner>
  18.    <BPIdentificationType>HCM001</BPIdentificationType>
  19.    <BPIdentificationNumber>R000001</BPIdentificationNumber>
  20.    <BPIdnNmbrIssuingInstitute></BPIdnNmbrIssuingInstitute>
  21.    <BPIdentificationEntryDate></BPIdentificationEntryDate>
  22.    <Country></Country>
  23.    <Region></Region>
  24.    <ValidityStartDate></ValidityStartDate>
  25.    <ValidityEndDate>31-12-99 00:00</ValidityEndDate>
  26.    <AuthorizationGroup></AuthorizationGroup>
  27.  </row>
  28.  <row>
  29.    <BusinessPartner>9980000003</BusinessPartner>
  30.    <BPIdentificationType>HCM001</BPIdentificationType>
  31.    <BPIdentificationNumber>R000002</BPIdentificationNumber>
  32.    <BPIdnNmbrIssuingInstitute></BPIdnNmbrIssuingInstitute>
  33.    <BPIdentificationEntryDate></BPIdentificationEntryDate>
  34.    <Country></Country>
  35.    <Region></Region>
  36.    <ValidityStartDate></ValidityStartDate>
  37.    <ValidityEndDate></ValidityEndDate>
  38.    <AuthorizationGroup></AuthorizationGroup>
  39.  </row>
  40.  <row>
  41.    <BusinessPartner>9980001106</BusinessPartner>
  42.    <BPIdentificationType>HCM001</BPIdentificationType>
  43.    <BPIdentificationNumber>620</BPIdentificationNumber>
  44.    <BPIdnNmbrIssuingInstitute></BPIdnNmbrIssuingInstitute>
  45.    <BPIdentificationEntryDate></BPIdentificationEntryDate>
  46.    <Country></Country>
  47.    <Region></Region>
  48.    <ValidityStartDate></ValidityStartDate>
  49.    <ValidityEndDate></ValidityEndDate>
  50.    <AuthorizationGroup></AuthorizationGroup>
  51.  </row>
  52.  <row>
  53.    <BusinessPartner>1000428</BusinessPartner>
  54.    <BPIdentificationType>BUP002</BPIdentificationType>
  55.    <BPIdentificationNumber>000785678</BPIdentificationNumber>
  56.    <BPIdnNmbrIssuingInstitute>Cenas</BPIdnNmbrIssuingInstitute>
  57.    <BPIdentificationEntryDate></BPIdentificationEntryDate>
  58.    <Country></Country>
  59.    <Region></Region>
  60.    <ValidityStartDate>13-11-19 00:00</ValidityStartDate>
  61.    <ValidityEndDate>23-11-23 00:00</ValidityEndDate>
  62.    <AuthorizationGroup></AuthorizationGroup>
  63.  </row>
  64.  <row>
  65.    <BusinessPartner>9980001120</BusinessPartner>
  66.    <BPIdentificationType>HCM001</BPIdentificationType>
  67.    <BPIdentificationNumber>627</BPIdentificationNumber>
  68.    <BPIdnNmbrIssuingInstitute></BPIdnNmbrIssuingInstitute>
  69.    <BPIdentificationEntryDate></BPIdentificationEntryDate>
  70.    <Country></Country>
  71.    <Region></Region>
  72.    <ValidityStartDate></ValidityStartDate>
  73.    <ValidityEndDate></ValidityEndDate>
  74.    <AuthorizationGroup></AuthorizationGroup>
  75.  </row>
  76.  <row>
  77.    <BusinessPartner>9980001122</BusinessPartner>
  78.    <BPIdentificationType>HCM001</BPIdentificationType>
  79.    <BPIdentificationNumber>622</BPIdentificationNumber>
  80.    <BPIdnNmbrIssuingInstitute></BPIdnNmbrIssuingInstitute>
  81.    <BPIdentificationEntryDate></BPIdentificationEntryDate>
  82.    <Country></Country>
  83.    <Region></Region>
  84.    <ValidityStartDate></ValidityStartDate>
  85.    <ValidityEndDate></ValidityEndDate>
  86.    <AuthorizationGroup></AuthorizationGroup>
  87.  </row>
  88. </root>
  89. '''
  90.  
  91. def test_list = []
  92.  
  93. def list = new XmlParser().parseText(text);
  94.  
  95. def row = list.children().find { node -> node.BusinessPartner.text() == "9980001120" }
  96.  
  97. test_list.add(list.row[3])
  98.  
  99. println(test_list)
  100.  
  101. println(row)
  102.  
  103. println(row.BusinessPartner.text())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement