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

Creating the junos.xsd File

Most of the tag elements defined in the schema returned in the <xsd:schema> tag belong to the default namespace for JUNOS configuration elements. However, at least one tag, <junos:comment>, belongs to a different namespace (in its case, http://xml.juniper.net/junos/JUNOS-version/junos). By XML convention, a schema describes only one namespace, so schema validators need to import information about any additional namespaces before they can process the schema.

In JUNOS Release 6.4 and later, the <xsd:import> tag element is enclosed in the <xsd:schema> tag element and references the file junos.xsd, which contains the required information about the junos namespace. For example, the following <xsd:import> tag element specifies the file for JUNOS Release 9.3R1 (and appears on two lines for legibility only):

<xsd:import schemaLocation="junos.xsd" \
namespace="http://xml.juniper.net/junos/9.3R1/junos"/>

To enable the schema validator to interpret the <xsd:import> tag element, you must manually create a file called junos.xsd in the directory where you place the .xsd file that contains the complete JUNOS configuration schema. Include the following text in the file. Do not use line breaks in the list of attributes in the opening <xsd:schema> tag. Line breaks appear in the following example for legibility only. For the JUNOS-version variable, substitute the release number of the JUNOS software running on the routing platform (for example, 9.3R1 for the first version of JUNOS Release 9.3).

<?xml version="1.0" encoding="us-ascii"?>
<xsd:schema elementFormDefault="qualified" \
attributeFormDefault="unqualified" \
xmlns:xsd="http://www.w3.org/2001/XMLSchema" \
targetNamespace="http://xml.juniper.net/junos/JUNOS-version/junos">
<xsd:element name="comment" type="xsd:string"/>
</xsd:schema>

Note: Schema validators might not be able to process the schema if they cannot locate or open the junos.xsd file.

Whenever you change the version of JUNOS software running on the routing platform, remember to update the JUNOS-version variable in the junos.xsd file to match.


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