I came up with a hack to list the attributes of a node:
- Save the current node to a temporary XML VARA
- Use PREP_PROCESS_VAR_XML to extract from the temporary XML VARA the name/value pairs of each attribute.
! Write current DOM node to temporary XML VARA
:SET &XML_VARA_Name# = UC0.TEMP_&$RUNID#.VARA_XML
:SET &XML_VARA_Key# = "Temp_XML"
:SET &XML_VARA_String# = XML_TO_STRING(&XML_DOM#)
:PUT_VAR &XML_VARA_Name#,&XML_VARA_Key#,&XML_VARA_String#
! Grab attribute list
:DEFINE &XML_Attr#,STRING,2
:SET &XML_Atrr_Delim# = ";"
:SET &XML_VARA_Xpath# = './*/@*/fn:concat(fn:name(.),"&XML_Atrr_Delim#",.)'
:SET &XML_Attr_Hnd# = PREP_PROCESS_VAR_XML(&XML_VARA_Name#, &XML_VARA_Key#, &XML_VARA_Xpath#)
:SET &Attr_Counter# = 0
:PROCESS &XML_Attr_Hnd#
: SET &Attr_Counter# = &Attr_Counter# + 1
: IF &Attr_Counter# = 1
: PRINT "Atrributes"
: PRINT " Name Value"
: ENDIF
: SET &XML_Attr_Line# = GET_PROCESS_LINE(&XML_Attr_Hnd#,0)
: FILL &XML_Attr#[] = STR_SPLIT(&XML_Attr_Line#,&XML_Atrr_Delim#)
: SET &XML_Attr_Name# = &XML_Attr#[1]
: SET &XML_Attr_Value# = &XML_Attr#[2]
: SET &XML_Attr_Name# = STR_PAD(&XML_Attr_Name#," ",16,LEFT)
: PRINT " &XML_Attr_Name#&XML_Attr_Value#"
:ENDPROCESS
:CLOSE_PROCESS &XML_Attr_Hnd#
This is a bit of a kludge, but it works. I put it in a JOBI and include it wherever I need to read element attributes. I create the temporary VARA at the beginning of the whole process, and remove it only after all of the steps that might need to use it have completed.