To write automation scripts, you must gather information about the JUNOS XML version of operational mode commands and output fields. You can do this by consulting the JUNOS XML API Operational Reference.
Another very useful tool is the | display xml command:
user@host> operational-mode-command | display xml
For example:
user@host> show interfaces terse | display
xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/7.6R1/junos">
<interface-information xmlns="http://xml.juniper.net/junos/7.6I0/junos-interface" junos:style="terse">
<physical-interface>
<name>dsc</name>
<admin-status>up</admin-status>
<oper-status>up</oper-status>
</physical-interface>
<physical-interface>
<name>fxp0</name>
<admin-status>up</admin-status>
<oper-status>up</oper-status>
<logical-interface>
<name>fxp0.0</name>
<admin-status>up</admin-status>
<oper-status>up</oper-status>
...