mavrosxristoforos / get-xml-info

Get Information from XML files to use into your GitHub workflows
GNU General Public License v3.0
6 stars 13 forks source link

steps.getxml.outputs.info structure #1

Closed phonglt7 closed 4 years ago

phonglt7 commented 4 years ago

Hi, could you please provide the structure of the ${{ steps.getxml.outputs.info }} object? How to access inner text, how to access attributes?

mavrosxristoforos commented 4 years ago

Hi there! The ${{ steps.getxml.outputs.info }} is just a string or an array of strings, which is either the inner text, or the attribute value, depending on your xpath. Example:

<xml>
  <parent name="Joey">
       <children>
         <child>Chandler</child>
         <child>Phoebe</child>
       </children>
  </parent>
</xml>

xpath: '//parent/@name' will return 'Joey' xpath: '//child' will return array[0 => 'Chandler', 1 => 'Phoebe']