namespace rng = "http://relaxng.org/ns/structure/1.0" namespace xsd = "http://www/w3/org/2001/XMLSchema-datatypes" namespace xml = "http://www.w3.org/XML/1998/namespace" namespace sch = "http://www.ascc.net/xml/schematron" namespace dc = "http://purl.org/dc/elements/1.1/" namespace dml = "http://example.org/ns/dml" namespace dhcp = "http://example.org/ns/dhcp" namespace cal = "http://example.org/ns/cal" namespace compat ="http://relaxng.org/ns/compatibility/annotations/1.0" default namespace = "http://example.org/ns/dhcp" start = element-dhcp >> sch:include [href="http://example.org/ns/dml.sch"] >> dc:title [ "Example schema for DHCP server" ] >> dml:version ["1.0"] >> dc:type ["Dataset"] >> dc:creator [ "Rohan Mahy" ] >> dml:organization [ "myself" ] >> dml:email [ "rohan@ekabal.com" ] >> dc:date [ "2008-02-13" ] element-dhcp = element dhcp { [ compat:documentation [ "This element provides information Dynamic Host Configuration Protocol (DHCP) subsystem." ] ] global-timer-elements, element-subnet*, element-shared-network* } global-timer-elements = ( [ compat:documentation [ "A collection of timers." ] sch:pattern [ sch:rule [ context = "//dhcp:dhcp" sch:assert [ test = "dhcp:default-lease-time <= dhcp:max-lease-time" "Default lease time cannot be larger than maximum lease time" ] ] ] ] element default-lease-time { xsd:unsignedInt }? >> dml:default ["3600"] >> dml:units ["s"] >> compat:documentation ["The lease time for a client, unless otherwise specified."], element max-lease-time { xsd:unsignedInt }? >> dml:units ["s"] >> compat:documentation ["The time that no client lease is allowed to exceed."] ) element-shared-network = element shared-network { [ compat:documentation [ "Information about the shared network." ] ] attribute name { token } >> sch:pattern [ is-a = "key" sch:param [ name = "list-context" value = "//dhcp:shared-network" ] sch:param [ name = "key" value = "@name" ] ], element-subnet+ >> sch:pattern [ is-a = "key" sch:param [ name = "list-context" value = "//dhcp:subnet" ] sch:param [ name = "key" value = "concat(dhcp:network, '/', dhcp:prefix-length)" ] ] >> dml:manual-validation-rule [ "Verify that none of the subnets overlap with other subnets." ] } element-subnet = element subnet { [ compat:documentation [ "Information about the subnetwork." ] ] element-network, element-prefix-length, element-range? >> dml:manual-validation-rule [ "Verify the range is within the subnet." ], element-dhcp-options?, element max-lease-time { xsd:unsignedInt }? >> dml:units ["s"], element leases { element-lease* >> sch:pattern [ is-a = "key" sch:param [ name = "list-context" value = "//dhcp:leases/dhcp:lease" ] sch:param [ name = "key" value = "@ip-address" ] ] }? >> dml:infoType ["status"], element-interface-filter? } element-network = element network { ipv4-address-content } element-prefix-length = element prefix-length { xsd:short { minInclusive = "0" maxInclusive = "32" } } element-range = element range { attribute key { token }, element dynamic-bootp { empty }? >> dml:existence [], element low { ipv4-address-content }? >> dml:mandatory [], element high { ipv4-address-content }? >> dml:mandatory [] } element-dhcp-options = element dhcp-options { element-router-list-option?, element-domain-list-option?, element-custom-option*, element cal:timezone { token }? # this is an example of simple inline extensibility } element-lease = element lease { attribute ip-address { ipv4-address-content }, element starts { xsd:dateTime }, element ends { xsd:dateTime }, element mac-address { mac-address-content } } element-router-list-option = element router-list { element router { ipv4-address-content }+ >> dml:order ["user-order"] } element-domain-list-option = element domain-list { element domain { token }+ } element-custom-option = element custom { attribute option { xsd:unsignedByte }, ( element ip-address { ipv4-address-content } | element string { string } ) } element-interface-filter = element interface-filter { element interface { token }+ >> sch:pattern [ is-a = "key" sch:param [ name = "list-context" value = "//dhcp:interface-filter/interface" ] sch:param [ name = "key" value = "current()" ] ] >> sch:pattern [ is-a="keyref" sch:param [ name="key-id" value="interface" ] sch:param [ name="keyref-context" value="//dhcp:interface-filter/dhcp:interface" ] sch:param [ name="key" value="int:ifIndex" ] sch:param [ name="key-context" value="//int:interfaces/int:interface" ] ] } ipv4-address-content = xsd:token { pattern = "((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])" } mac-address-content = xsd:token { pattern = "(([0-9a-fA-F]{2}):?){5}[0-9a-fA-F]{2}" }