[Contents] [Prev] [Next] [Index] [Report an Error]

Requesting Output as Formatted ASCII Text or JUNOS XML Tag Elements

To request that the JUNOScript server return configuration information as formatted ASCII text instead of tagging it with JUNOS XML tag elements, a client application includes the format="text" attribute in the <get-configuration/> tag or opening <get-configuration> tag. It encloses the request in an <rpc> tag element:

<rpc>
<get-configuration format="text"/>

<!- - OR - ->

<get-configuration format="text">
<!- - tag elements for the configuration elements to return - ->
</get-configuration>
</rpc>

To request JUNOS XML-tagged output, the client application either includes the format="xml" attribute or omits the attribute completely (the JUNOScript server returns JUNOS XML-tagged output by default):

<rpc>
<get-configuration/>

<!- - OR - ->

<get-configuration>
<!- - tag elements for the configuration elements to return - ->
</get-configuration>
</rpc>

For information about the tag elements to enclose in the <get-configuration> tag element, see Specifying the Scope of Configuration Information to Return.

Note: Regardless of which output format they request, client applications use JUNOS XML tag elements to represent the configuration element to display. The format attribute controls the format of the JUNOScript server’s output only.

When the application requests formatted ASCII output, the JUNOScript server formats its response in the same way that the CLI show configuration command displays configuration data—it uses the newline character, tabs, braces, and square brackets to indicate the hierarchical relationships between configuration statements. The server encloses formatted ASCII configuration statements in <rpc-reply> and <configuration-text> tag elements:

<rpc-reply xmlns:junos="URL">
<configuration-text>
<!- - formatted ASCII configuration statements - ->
</configuration-text>
</rpc-reply>

When the application requests JUNOS XML tag elements, the JUNOScript server encloses its output in <rpc-reply> and <configuration> tag elements. For information about the attributes in the opening <configuration> tag, see Requesting Information from the Committed or Candidate Configuration.

<rpc-reply xmlns:junos="URL">
<configuration attributes>
<!- - JUNOS XML tag elements representing configuration elements - ->
</configuration>
</rpc-reply>

The format attribute can be combined with one or more of the following other attributes in the <get-configuration/> tag or opening <get-configuration> tag:

It does not make sense to combine the format="text" attribute with the changed attribute (described in Requesting a Change Indicator for Configuration Elements) or to include it after requesting an indicator for identifiers (described in Requesting an Indicator for Identifiers). The change and identifier indicators appear only in JUNOS XML-tagged output, which is the default output format.

An application can request JUNOS-XML tagged output or formatted ASCII text for the entire configuration or any portion of it. For instructions on specifying the amount of data to return, see Specifying the Scope of Configuration Information to Return.

The following example shows how to request formatted ASCII output from the [edit policy-options] hierarchy level in the candidate configuration.

Image t1121.gif
[Contents] [Prev] [Next] [Index] [Report an Error]