Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
#26 xs:include
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Feb 2, 2017
1 parent 9a0eff4 commit 3de88bc
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 42 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Gemfile.lock
.DS_Store
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ task :xsd do
print "Checking #{p}... "
f = p.sub(/xml\//, 'xsd/').sub(/\/[^\/]+\.xml$/, '.xsd')
begin
xsd = Nokogiri::XML::Schema(File.read(f))
xsd = Nokogiri::XML::Schema(File.open(f))
rescue Nokogiri::XML::SyntaxError => e
print "\n#{f} #{e.line}: #{e.message}"
raise 'XSD is invalid'
Expand Down
23 changes: 23 additions & 0 deletions xml/pm/in/orders/simple.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) 2016-2017 Zerocracy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to read
* the Software only. Permissions is hereby NOT GRANTED to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
-->
<orders>
<order job="gh:yegor256/pdd#3">
<performer>yegor256</performer>
<created>2016-12-29T09:03:21.684Z</created>
</order>
</orders>
6 changes: 1 addition & 5 deletions xsd/pm/claims.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
-->
<xs:schema version="SNAPSHOT" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="github">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z0-9\-]{3,}"/>
</xs:restriction>
</xs:simpleType>
<xs:include schemaLocation="http://raw.githubusercontent.com/zerocracy/datum/0.16/xsd/pmo/types.xsd"/>
<xs:simpleType name="type">
<xs:restriction base="xs:string">
<xs:enumeration value="hello"/>
Expand Down
6 changes: 1 addition & 5 deletions xsd/pm/cost/cost-estimates.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
-->
<xs:schema version="SNAPSHOT" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="jobID">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z]{2}:[A-Z0-9a-z.\-#/]{3,}"/>
</xs:restriction>
</xs:simpleType>
<xs:include schemaLocation="http://raw.githubusercontent.com/zerocracy/datum/0.16/xsd/pm/scope/types.xsd"/>
<xs:complexType name="job">
<xs:all>
<xs:element name="minutes" type="xs:int" minOccurs="0" maxOccurs="1"/>
Expand Down
13 changes: 2 additions & 11 deletions xsd/pm/hr/roles.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,12 @@
-->
<xs:schema version="SNAPSHOT" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="role">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]{2,4}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="id">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z0-9\-]{3,}"/>
</xs:restriction>
</xs:simpleType>
<xs:include schemaLocation="http://raw.githubusercontent.com/zerocracy/datum/0.16/xsd/pm/hr/types.xsd"/>
<xs:complexType name="person">
<xs:sequence>
<xs:element name="role" type="role" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" type="id" use="required" />
<xs:attribute name="id" type="github" use="required" />
</xs:complexType>
<xs:element name="roles">
<xs:complexType>
Expand Down
40 changes: 40 additions & 0 deletions xsd/pm/in/orders.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) 2016-2017 Zerocracy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to read
* the Software only. Permissions is hereby NOT GRANTED to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
-->
<xs:schema version="SNAPSHOT" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="http://raw.githubusercontent.com/zerocracy/datum/0.16/xsd/pmo/types.xsd"/>
<xs:include schemaLocation="http://raw.githubusercontent.com/zerocracy/datum/0.16/xsd/pm/scope/types.xsd"/>
<xs:complexType name="order">
<xs:all>
<xs:element name="performer" type="login" minOccurs="1" maxOccurs="1"/>
<xs:element name="created" minOccurs="1" maxOccurs="1" type="xs:dateTime"/>
</xs:all>
<xs:attribute name="job" use="required" type="jobID"/>
</xs:complexType>
<xs:element name="orders">
<xs:complexType>
<xs:sequence>
<xs:element name="order" type="order" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="orderID">
<xs:selector xpath="order" />
<xs:field xpath="@job" />
</xs:unique>
</xs:element>
</xs:schema>
12 changes: 2 additions & 10 deletions xsd/pm/scope/wbs.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,8 @@
-->
<xs:schema version="SNAPSHOT" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="jobID">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z]{2}:[A-Z0-9a-z.\-#/]{3,}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="github">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z0-9\-]{3,}"/>
</xs:restriction>
</xs:simpleType>
<xs:include schemaLocation="http://raw.githubusercontent.com/zerocracy/datum/0.16/xsd/pmo/types.xsd"/>
<xs:include schemaLocation="http://raw.githubusercontent.com/zerocracy/datum/0.16/xsd/pm/scope/types.xsd"/>
<xs:complexType name="job">
<xs:all>
<xs:element name="performer" type="github" minOccurs="0" maxOccurs="1"/>
Expand Down
6 changes: 1 addition & 5 deletions xsd/pmo/catalog.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
-->
<xs:schema version="SNAPSHOT" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="id">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z0-9]{9,}|PMO"/>
</xs:restriction>
</xs:simpleType>
<xs:include schemaLocation="http://raw.githubusercontent.com/zerocracy/datum/0.16/xsd/pmo/types.xsd"/>
<xs:complexType name="link">
<xs:simpleContent>
<xs:extension base="xs:string">
Expand Down
6 changes: 1 addition & 5 deletions xsd/pmo/people.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
-->
<xs:schema version="SNAPSHOT" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="github">
<xs:restriction base="xs:string">
<xs:pattern value="[a-z0-9\-]{3,}"/>
</xs:restriction>
</xs:simpleType>
<xs:include schemaLocation="http://raw.githubusercontent.com/zerocracy/datum/0.16/xsd/pmo/types.xsd"/>
<xs:complexType name="cash">
<xs:simpleContent>
<xs:extension base="xs:float">
Expand Down

0 comments on commit 3de88bc

Please sign in to comment.