XML Schemas
authorBen McGinnes <ben@adversary.org>
Fri, 25 Mar 2016 16:59:14 +0000 (03:59 +1100)
committerBen McGinnes <ben@adversary.org>
Fri, 25 Mar 2016 16:59:14 +0000 (03:59 +1100)
* Generated XML schemas in all four schema types (Relax-NG, Relax-NG
  Compact, W3C XSD and DTD) for the GPGME keylist XML output.

lang/README
lang/xml-schemas/gpgmekeys.dtd [new file with mode: 0644]
lang/xml-schemas/gpgmekeys.rnc [new file with mode: 0644]
lang/xml-schemas/gpgmekeys.rng [new file with mode: 0644]
lang/xml-schemas/gpgmekeys.xsd [new file with mode: 0644]

index da54c78..8dfaa54 100644 (file)
@@ -10,3 +10,4 @@ sub-directory.
 Directory      Language
 
 cl             Common Lisp
+xml-schemas    XML (schema files for Relax-NG, RNG compact, W3C XSD and DTD)
diff --git a/lang/xml-schemas/gpgmekeys.dtd b/lang/xml-schemas/gpgmekeys.dtd
new file mode 100644 (file)
index 0000000..08c0402
--- /dev/null
@@ -0,0 +1,132 @@
+<?xml encoding="UTF-8"?>
+
+<!ELEMENT gpgme (keylist)>
+<!ATTLIST gpgme
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT keylist (key)+>
+<!ATTLIST keylist
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT key (revoked,expired,disabled,invalid,can-encrypt,can-sign,
+               can-certify,can-authenticate,is-qualified,secret,
+               protocol,issuer,chain-id,owner-trust,subkeys,uids)>
+<!ATTLIST key
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT revoked EMPTY>
+<!ATTLIST revoked
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT expired EMPTY>
+<!ATTLIST expired
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT disabled EMPTY>
+<!ATTLIST disabled
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT invalid EMPTY>
+<!ATTLIST invalid
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT can-encrypt EMPTY>
+<!ATTLIST can-encrypt
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT can-sign EMPTY>
+<!ATTLIST can-sign
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT can-certify EMPTY>
+<!ATTLIST can-certify
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT can-authenticate EMPTY>
+<!ATTLIST can-authenticate
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT is-qualified EMPTY>
+<!ATTLIST is-qualified
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT protocol (#PCDATA)>
+<!ATTLIST protocol
+  xmlns CDATA #FIXED ''
+  value CDATA #REQUIRED>
+
+<!ELEMENT issuer (serial,name)>
+<!ATTLIST issuer
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT chain-id EMPTY>
+<!ATTLIST chain-id
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT owner-trust (#PCDATA)>
+<!ATTLIST owner-trust
+  xmlns CDATA #FIXED ''
+  value CDATA #REQUIRED>
+
+<!ELEMENT subkeys (subkey)+>
+<!ATTLIST subkeys
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT uids (uid)+>
+<!ATTLIST uids
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT serial EMPTY>
+<!ATTLIST serial
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT subkey (keyid,fpr,secret,is_cardkey,curve?)>
+<!ATTLIST subkey
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT keyid (#PCDATA)>
+<!ATTLIST keyid
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT fpr (#PCDATA)>
+<!ATTLIST fpr
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT is_cardkey EMPTY>
+<!ATTLIST is_cardkey
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT curve (#PCDATA)>
+<!ATTLIST curve
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT secret EMPTY>
+<!ATTLIST secret
+  xmlns CDATA #FIXED ''
+  value NMTOKEN #REQUIRED>
+
+<!ELEMENT name (#PCDATA)>
+<!ATTLIST name
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT uid (#PCDATA|name|uid|comment|email)*>
+<!ATTLIST uid
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT comment (#PCDATA)>
+<!ATTLIST comment
+  xmlns CDATA #FIXED ''>
+
+<!ELEMENT email (#PCDATA)>
+<!ATTLIST email
+  xmlns CDATA #FIXED ''>
diff --git a/lang/xml-schemas/gpgmekeys.rnc b/lang/xml-schemas/gpgmekeys.rnc
new file mode 100644 (file)
index 0000000..ef669a6
--- /dev/null
@@ -0,0 +1,75 @@
+default namespace = ""
+
+start =
+  element gpgme {
+    element keylist {
+      element key {
+        element revoked {
+          attribute value { xsd:NMTOKEN }
+        },
+        element expired {
+          attribute value { xsd:NMTOKEN }
+        },
+        element disabled {
+          attribute value { xsd:NMTOKEN }
+        },
+        element invalid {
+          attribute value { xsd:NMTOKEN }
+        },
+        element can-encrypt {
+          attribute value { xsd:NMTOKEN }
+        },
+        element can-sign {
+          attribute value { xsd:NMTOKEN }
+        },
+        element can-certify {
+          attribute value { xsd:NMTOKEN }
+        },
+        element can-authenticate {
+          attribute value { xsd:NMTOKEN }
+        },
+        element is-qualified {
+          attribute value { xsd:NMTOKEN }
+        },
+        secret,
+        element protocol {
+          attribute value { xsd:integer },
+          xsd:NCName
+        },
+        element issuer {
+          element serial { empty },
+          name
+        },
+        element chain-id { empty },
+        element owner-trust {
+          attribute value { xsd:integer },
+          xsd:NCName
+        },
+        element subkeys {
+          element subkey {
+            element keyid { xsd:NMTOKEN },
+            element fpr { text },
+            secret,
+            element is_cardkey {
+              attribute value { xsd:NMTOKEN }
+            },
+            element curve { xsd:NCName }?
+          }+
+        },
+        element uids { uid+ }
+      }+
+    }
+  }
+secret =
+  element secret {
+    attribute value { xsd:NMTOKEN }
+  }
+name = element name { text }
+uid =
+  element uid {
+    (text
+     | name
+     | uid
+     | element comment { text }
+     | element email { xsd:anyURI })+
+  }
diff --git a/lang/xml-schemas/gpgmekeys.rng b/lang/xml-schemas/gpgmekeys.rng
new file mode 100644 (file)
index 0000000..f8fad91
--- /dev/null
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+  <start>
+    <element name="gpgme">
+      <element name="keylist">
+        <oneOrMore>
+          <element name="key">
+            <element name="revoked">
+              <attribute name="value">
+                <data type="NMTOKEN"/>
+              </attribute>
+            </element>
+            <element name="expired">
+              <attribute name="value">
+                <data type="NMTOKEN"/>
+              </attribute>
+            </element>
+            <element name="disabled">
+              <attribute name="value">
+                <data type="NMTOKEN"/>
+              </attribute>
+            </element>
+            <element name="invalid">
+              <attribute name="value">
+                <data type="NMTOKEN"/>
+              </attribute>
+            </element>
+            <element name="can-encrypt">
+              <attribute name="value">
+                <data type="NMTOKEN"/>
+              </attribute>
+            </element>
+            <element name="can-sign">
+              <attribute name="value">
+                <data type="NMTOKEN"/>
+              </attribute>
+            </element>
+            <element name="can-certify">
+              <attribute name="value">
+                <data type="NMTOKEN"/>
+              </attribute>
+            </element>
+            <element name="can-authenticate">
+              <attribute name="value">
+                <data type="NMTOKEN"/>
+              </attribute>
+            </element>
+            <element name="is-qualified">
+              <attribute name="value">
+                <data type="NMTOKEN"/>
+              </attribute>
+            </element>
+            <ref name="secret"/>
+            <element name="protocol">
+              <attribute name="value">
+                <data type="integer"/>
+              </attribute>
+              <data type="NCName"/>
+            </element>
+            <element name="issuer">
+              <element name="serial">
+                <empty/>
+              </element>
+              <ref name="name"/>
+            </element>
+            <element name="chain-id">
+              <empty/>
+            </element>
+            <element name="owner-trust">
+              <attribute name="value">
+                <data type="integer"/>
+              </attribute>
+              <data type="NCName"/>
+            </element>
+            <element name="subkeys">
+              <oneOrMore>
+                <element name="subkey">
+                  <element name="keyid">
+                    <data type="NMTOKEN"/>
+                  </element>
+                  <element name="fpr">
+                    <text/>
+                  </element>
+                  <ref name="secret"/>
+                  <element name="is_cardkey">
+                    <attribute name="value">
+                      <data type="NMTOKEN"/>
+                    </attribute>
+                  </element>
+                  <optional>
+                    <element name="curve">
+                      <data type="NCName"/>
+                    </element>
+                  </optional>
+                </element>
+              </oneOrMore>
+            </element>
+            <element name="uids">
+              <oneOrMore>
+                <ref name="uid"/>
+              </oneOrMore>
+            </element>
+          </element>
+        </oneOrMore>
+      </element>
+    </element>
+  </start>
+  <define name="secret">
+    <element name="secret">
+      <attribute name="value">
+        <data type="NMTOKEN"/>
+      </attribute>
+    </element>
+  </define>
+  <define name="name">
+    <element name="name">
+      <text/>
+    </element>
+  </define>
+  <define name="uid">
+    <element name="uid">
+      <oneOrMore>
+        <choice>
+          <text/>
+          <ref name="name"/>
+          <ref name="uid"/>
+          <element name="comment">
+            <text/>
+          </element>
+          <element name="email">
+            <data type="anyURI"/>
+          </element>
+        </choice>
+      </oneOrMore>
+    </element>
+  </define>
+</grammar>
diff --git a/lang/xml-schemas/gpgmekeys.xsd b/lang/xml-schemas/gpgmekeys.xsd
new file mode 100644 (file)
index 0000000..9efd94e
--- /dev/null
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+  <xs:element name="gpgme">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="keylist"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="keylist">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="key"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="key">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="revoked"/>
+        <xs:element ref="expired"/>
+        <xs:element ref="disabled"/>
+        <xs:element ref="invalid"/>
+        <xs:element ref="can-encrypt"/>
+        <xs:element ref="can-sign"/>
+        <xs:element ref="can-certify"/>
+        <xs:element ref="can-authenticate"/>
+        <xs:element ref="is-qualified"/>
+        <xs:element ref="secret"/>
+        <xs:element ref="protocol"/>
+        <xs:element ref="issuer"/>
+        <xs:element ref="chain-id"/>
+        <xs:element ref="owner-trust"/>
+        <xs:element ref="subkeys"/>
+        <xs:element ref="uids"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="revoked">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="expired">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="disabled">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="invalid">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="can-encrypt">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="can-sign">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="can-certify">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="can-authenticate">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="is-qualified">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="protocol">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:NCName">
+          <xs:attribute name="value" use="required" type="xs:integer"/>
+        </xs:extension>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="issuer">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="serial"/>
+        <xs:element ref="name"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="serial">
+    <xs:complexType/>
+  </xs:element>
+  <xs:element name="chain-id">
+    <xs:complexType/>
+  </xs:element>
+  <xs:element name="owner-trust">
+    <xs:complexType>
+      <xs:simpleContent>
+        <xs:extension base="xs:NCName">
+          <xs:attribute name="value" use="required" type="xs:integer"/>
+        </xs:extension>
+      </xs:simpleContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="subkeys">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="subkey"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="subkey">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="keyid"/>
+        <xs:element ref="fpr"/>
+        <xs:element ref="secret"/>
+        <xs:element ref="is_cardkey"/>
+        <xs:element minOccurs="0" ref="curve"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="keyid" type="xs:NMTOKEN"/>
+  <xs:element name="fpr" type="xs:string"/>
+  <xs:element name="is_cardkey">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="curve" type="xs:NCName"/>
+  <xs:element name="uids">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="uid"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="secret">
+    <xs:complexType>
+      <xs:attribute name="value" use="required" type="xs:NMTOKEN"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="name" type="xs:string"/>
+  <xs:element name="uid">
+    <xs:complexType mixed="true">
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element ref="name"/>
+        <xs:element ref="uid"/>
+        <xs:element ref="comment"/>
+        <xs:element ref="email"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="comment" type="xs:string"/>
+  <xs:element name="email" type="xs:anyURI"/>
+</xs:schema>