Browse Source

Fix XML schema. The examples is validated now.

git-svn-id: https://klish.googlecode.com/svn/trunk@270 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 14 years ago
parent
commit
3c5f954934

+ 25 - 22
clish.xsd

@@ -123,24 +123,38 @@
 *******************************************************
 * <VIEW> defines the contents of a specific CLI view.
 *
-* name   - a textual name for the view
-*
-* prompt - a textual definition of the prompt to be 
-*          used whilst in this view.
-*          NB. The prompt may contain environment
-*              or dynamic variables which are expanded
-*              before display. 
-* depth  - a depth of nested view (uses for config).
+* name      - a textual name for the view
+*
+* prompt    - a textual definition of the prompt to be
+*           used whilst in this view.
+*           NB. The prompt may contain environment
+*           or dynamic variables which are expanded
+*           before display.
+*
+* [depth]   - a depth of nested view (uses for config).
+*
+* [restore] - restore the depth or view of commands
+*           contained by this view
 ********************************************************
 -->
+
+    <xs:simpleType name="restore_t">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="none"/>
+            <xs:enumeration value="depth"/>
+            <xs:enumeration value="view"/>
+        </xs:restriction>
+    </xs:simpleType>
+
     <xs:complexType name="view_t">
         <xs:sequence>
-            <xs:element ref="COMMAND" maxOccurs="unbounded"/>
-            <xs:element ref="NAMESPACE" maxOccurs="unbounded"/>
+            <xs:element ref="NAMESPACE" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element ref="COMMAND" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
         <xs:attribute name="name" type="xs:string" use="required"/>
         <xs:attribute name="prompt" type="xs:string" use="optional"/>
         <xs:attribute name="depth" type="xs:string" use="optional" default="0"/>
+        <xs:attribute name="restore" type="restore_t" use="optional" default="none"/>
     </xs:complexType>
     <!--
 *******************************************************
@@ -212,8 +226,8 @@
         <xs:sequence>
             <xs:element ref="DETAIL" minOccurs="0"/>
             <xs:element ref="PARAM" minOccurs="0" maxOccurs="unbounded"/>
-            <xs:element ref="ACTION" minOccurs="0"/>
             <xs:element ref="CONFIG" minOccurs="0"/>
+            <xs:element ref="ACTION" minOccurs="0"/>
         </xs:sequence>
         <xs:attributeGroup ref="menu_item_g"/>
         <xs:attribute name="view" type="xs:string" use="optional"/>
@@ -377,18 +391,8 @@
 *
 * [inherit]      - a boolean flag to inherit nested
 *                namespace commands recursively
-*
-* [restore]      - restore the depth or view of commands
-*                included by this namespace
 ********************************************************
 -->
-    <xs:simpleType name="restore_t">
-        <xs:restriction base="xs:string">
-            <xs:enumeration value="none"/>
-            <xs:enumeration value="depth"/>
-            <xs:enumeration value="view"/>
-        </xs:restriction>
-    </xs:simpleType>
 
     <xs:complexType name="namespace_t">
         <xs:attribute name="ref" type="xs:string" use="required"/>
@@ -398,7 +402,6 @@
         <xs:attribute name="completion" type="bool_t" use="optional" default="true"/>
         <xs:attribute name="context_help" type="bool_t" use="optional" default="false"/>
         <xs:attribute name="inherit" type="bool_t" use="optional" default="true"/>
-        <xs:attribute name="restore" type="restore_t" use="optional" default="none"/>
     </xs:complexType>
 
 <!--

+ 3 - 3
xml-examples/klish/etc/clish-xml/configure-mode.xml

@@ -9,7 +9,7 @@
 	prompt="${SYSTEM_NAME}(config)# "
 	restore="depth">
 
-<!------ Inheritance ------>
+<!-- Inheritance -->
 
 	<NAMESPACE ref="enable-view" 
 		prefix="do"
@@ -19,7 +19,7 @@
 	<COMMAND name="do"
 		help="To run exec commands in config mode"/>
 
-<!------ Virtual commands ------>
+<!-- Virtual commands -->
 
 	<COMMAND name="no"
 		help="Negate a command or set its defaults"/>
@@ -30,7 +30,7 @@
 	<COMMAND name="no ip"
 		help="Global IP configuration subcommands"/>
 
-<!------ Simple configuration mode commands ------>
+<!-- Simple configuration mode commands -->
 
 	<COMMAND name="exit"
 		help="Exit from configure mode"

+ 4 - 4
xml-examples/klish/etc/clish-xml/enable-mode.xml

@@ -7,13 +7,13 @@
 <VIEW name="enable-view"
 	prompt="${SYSTEM_NAME}# ">
 
-<!------ Inheritance ------>
+<!-- Inheritance -->
 
 	<NAMESPACE ref="ping-view" 
 		help="true"
 		completion="true"/>
 
-<!------ Simple enable mode commands ------>
+<!-- Simple enable mode commands -->
 
 	<COMMAND name="disable"
 		help="Turn off privileged commands">
@@ -33,7 +33,7 @@
 		view="configure-view">
 	</COMMAND>
 
-<!------ Show commands ------>
+<!-- Show commands -->
 
 	<COMMAND name="show"
 		help="Show running system information"/>
@@ -56,7 +56,7 @@
 		<ACTION>cat /etc/startup-config</ACTION>
 	</COMMAND>
 
-<!------ Copy commands ------>
+<!-- Copy commands -->
 
 	<COMMAND name="copy"
 		help="Copy from one file to another"/>

+ 2 - 2
xml-examples/klish/etc/clish-xml/info-mode.xml

@@ -8,13 +8,13 @@
 <VIEW name="info-view"
 	prompt="${SYSTEM_NAME}&gt; ">
 
-<!------ Inheritance ------>
+<!-- Inheritance -->
 
 	<NAMESPACE ref="ping-view" 
 		help="true"
 		completion="true"/>
 
-<!------ Simple non-priveledged mode commands ------>
+<!-- Simple non-priveledged mode commands -->
 
 	<COMMAND name="enable"
 		help="Turn on privileged commands"

+ 4 - 4
xml-examples/klish/etc/clish-xml/interface.xml

@@ -40,13 +40,13 @@
 	prompt="${SYSTEM_NAME}(config-if-${iface})# "
 	depth="1">
 
-<!------ Inheritance ------>
+<!-- Inheritance -->
 
 	<NAMESPACE ref="configure-view"
 		help="false"
 		completion="true"/>
 
-<!------ Simple configure-if mode commands ------>
+<!-- Simple configure-if mode commands -->
 
 	<COMMAND name="exit"
 		help="Exit from interface configuration mode"
@@ -63,7 +63,7 @@
 	<COMMAND name="no ip"
 		help="Interface Internet Protocol config commands"/>
 
-<!------ IP address ------>
+<!-- IP address -->
 
 	<COMMAND name="ip address"
 		help="Set the IP address of an interface">
@@ -98,7 +98,7 @@
 		</ACTION>
 	</COMMAND>
 
-<!------ Enable/Disable ------>
+<!-- Enable/Disable -->
 
 	<COMMAND name="disable"
 		help="Disable the selected interface">

+ 4 - 4
xml-examples/klish/etc/clish-xml/route.xml

@@ -7,7 +7,7 @@
 
 <VIEW name="enable-view">
 
-<!------ Show routing information ------>
+<!-- Show routing information -->
 
 	<COMMAND name="show ip route"
 		help="IP routing table">
@@ -19,7 +19,7 @@
 
 <VIEW name="configure-view">
 
-<!------ Enable/Disable routing ------>
+<!-- Enable/Disable routing -->
 
 	<COMMAND name="ip routing"
 		help="Enable IP routing">
@@ -37,7 +37,7 @@
 		</ACTION>
 	</COMMAND>
 
-<!------ Default gateway ------>
+<!-- Default gateway -->
 
 	<COMMAND name="ip default-gateway"
 		help="Specify default gateway (if not routing IP)">
@@ -58,7 +58,7 @@
 		</ACTION>
 	</COMMAND>
 
-<!------ Set/Unset static route ------>
+<!-- Set/Unset static route -->
 
 	<COMMAND name="ip route"
 		help="Establish static routes">