Displaying CLI Output as XML Tag Elements

To display the output from a CLI command as Junos XML protocol tag elements and Junos XML tag elements instead of as the default formatted ASCII text, pipe the output from the command to the display xml command. The tag elements that describe Junos OS configuration or operational data belong to the Junos XML API, which defines the Junos content that can be retrieved and manipulated by the Junos XML management protocol operations.

The following example shows the output from the show chassis hardware command issued on an M20 router that is running the initial version of Junos OS Release 10.3 (the opening <chassis-inventory> tag appears on two lines only for legibility):

user@host> show chassis hardware | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/10.3R1/junos">
    <chassis-inventory \
                xmlns="http://xml.juniper.net/junos/10.3R1/junos-chassis">
        <chassis junos:style="inventory">
            <name>Chassis</name>
            <serial-number>00118</serial-number>
            <description>M20</description>
            <chassis-module>
                <name>Backplane</name>
                <version>REV 06</version>
                <part-number>710-001517</part-number>
                <serial-number>AB5911</serial-number>
            </chassis-module>
            <chassis-module>
                <name>Power Supply A</name>
                <!-- other child tags of <chassis-module> -->
            </chassis-module>
            <!-- other child tags of <chassis> -->
        </chassis>
    </chassis-inventory>
</rpc-reply>