[gxml] Pulished XSD API on GomXsd* and Xsd* types



commit 9bd60035fc31ad152388a7e711ef0d0df0a1ffc7
Author: Daniel Espinosa <esodan gmail com>
Date:   Mon Jan 23 11:32:35 2017 -0600

    Pulished XSD API on GomXsd* and Xsd* types

 gxml/GomSchema.vala |   98 +++++++++++++++++++++++++++++++++++++--------------
 gxml/Schema.vala    |   70 +++++++++++++++++++++---------------
 2 files changed, 111 insertions(+), 57 deletions(-)
---
diff --git a/gxml/GomSchema.vala b/gxml/GomSchema.vala
index 9a132d9..1fba6da 100644
--- a/gxml/GomSchema.vala
+++ b/gxml/GomSchema.vala
@@ -42,44 +42,78 @@ public class GXml.GomXsdSimpleType : GomElement {
   public string final { get; set; }
   public string name { get; set; }
   public GomXsdAnnotation annotation { get; set; }
-  public GomXsdSimpleTypeDefinition definition { get; set; }
-  construct { initialize (GXml.XsdSimpleType.SCHEMA_NODE_NAME); }
+  public GomXsdTypeList list { get; set; }
+  public GomXsdTypeUnion union { get; set; }
+  public GomXsdTypeRestriction restriction { get; set; }
+  construct {
+    initialize_with_namespace (XsdSchema.SCHEMA_NAMESPACE_URI,
+                              XsdSchema.SCHEMA_NAMESPACE_PREFIX,
+                              XsdSimpleType.SCHEMA_NODE_NAME);
+  }
 }
 
-public class GXml.GomXsdSimpleTypeDefinition : GomElement {
+public class GXml.GomXsdTypeDefinition : GomElement {
   public GomXsdAnnotation annotation { get; set; }
 }
-public class GXml.GomXsdTypeRestriction : GomXsdSimpleTypeDefinition {
+public class GXml.GomXsdTypeList : GomXsdTypeDefinition {}
+public class GXml.GomXsdTypeUnion : GomXsdTypeDefinition {}
+public class GXml.GomXsdTypeRestriction : GomXsdTypeDefinition {
+  [Description (nick="::base")]
   public string base { get; set; }
+  [Description (nick="::id")]
   public string id { get; set; }
   public GomXsdSimpleType simple_type { get; set; }
-  /**
-   * List of {link GomXsdTypeRestrictionDefinition} objects
-   */
-  public GomXsdList definition { get; set; }
+  public GomXsdListTypeRestrictionEnumerations enumerations { get; set; }
+  public GomXsdListTypeRestrictionWhiteSpaces white_spaces { get; set; }
+  construct {
+    initialize_with_namespace (XsdSchema.SCHEMA_NAMESPACE_URI,
+                              XsdSchema.SCHEMA_NAMESPACE_PREFIX,
+                              XsdTypeRestriction.SCHEMA_NODE_NAME);
+  }
 }
 
-public class GXml.GomXsdTypeRestrictionDefinition : GomElement {
+public class GXml.GomXsdTypeRestrictionDef : GomElement {
   public GomXsdAnnotation annotation { get; set; }
 }
-public class GXml.GomXsdTypeRestrictionMinExclusive : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionMinInclusive : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionMaxExclusive : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionMaxInclusive : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionTotalDigits : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionFractionDigits : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionLength : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionMinLength : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionMaxLength : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionEnumeration : GomXsdTypeRestrictionDefinition {
+public class GXml.GomXsdTypeRestrictionMinExclusive : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionMinInclusive : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionMaxExclusive : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionMaxInclusive : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionTotalDigits : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionFractionDigits : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionLength : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionMinLength : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionMaxLength : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionEnumeration : GomXsdTypeRestrictionDef {
+  [Description (nick="::base")]
+  public string id { get; set; }
+  [Description (nick="::value")]
+  public string value { get; set; }
+  construct {
+    initialize_with_namespace (XsdSchema.SCHEMA_NAMESPACE_URI,
+                              XsdSchema.SCHEMA_NAMESPACE_PREFIX,
+                              XsdTypeRestrictionEnumeration.SCHEMA_NODE_NAME);
+  }
+}
+public class GXml.GomXsdTypeRestrictionWhiteSpace: GomXsdTypeRestrictionDef {
+  public Fixed fixed { get; set; }
+  [Description (nick="::id")]
   public string id { get; set; }
+  /**
+   * (collapse | preserve | replace)
+   */
+  [Description (nick="::value")]
   public string value { get; set; }
-  construct { initialize (GXml.XsdTypeRestrictionEnumeration.SCHEMA_NODE_NAME); }
+  construct {
+    initialize_with_namespace (XsdSchema.SCHEMA_NAMESPACE_URI,
+                              XsdSchema.SCHEMA_NAMESPACE_PREFIX,
+                              XsdTypeRestrictionWhiteSpace.SCHEMA_NODE_NAME);
+  }
+  public class Fixed : GomBoolean { construct { initialize ("fixed"); } }
 }
-public class GXml.GomXsdTypeRestrictionWhiteSpace: GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionPattern : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionAssertion : GomXsdTypeRestrictionDefinition {}
-public class GXml.GomXsdTypeRestrictionExplicitTimezone : GomXsdTypeRestrictionDefinition {}
+public class GXml.GomXsdTypeRestrictionPattern : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionAssertion : GomXsdTypeRestrictionDef {}
+public class GXml.GomXsdTypeRestrictionExplicitTimezone : GomXsdTypeRestrictionDef {}
 
 public class GXml.GomXsdComplexType : GomXsdBaseType {
   protected GomXsdList _type_attributes = null;
@@ -165,9 +199,13 @@ public class GXml.GomXsdElement : GomElement {
    */
   public string object_type { get; set; }
   public GomXsdAnnotation anotation { get; set; }
-  public GomXsdListSimpleTypes simple_type_definitions { get; set; }
-  public GomXsdListComplexTypes complex_type_definitions { get; set; }
-  construct { initialize (GXml.XsdElement.SCHEMA_NODE_NAME); }
+  public GomXsdSimpleType simple_type { get; set; }
+  public GomXsdComplexType complex_type { get; set; }
+  construct {
+    initialize_with_namespace (XsdSchema.SCHEMA_NAMESPACE_URI,
+                              XsdSchema.SCHEMA_NAMESPACE_PREFIX,
+                              XsdElement.SCHEMA_NODE_NAME);
+  }
 }
 
 
@@ -223,3 +261,9 @@ public class GXml.GomXsdListSimpleTypes : GomXsdList {
 public class GXml.GomXsdListComplexTypes : GomXsdList {
   construct { initialize (typeof (GomXsdComplexType)); }
 }
+public class GXml.GomXsdListTypeRestrictionEnumerations : GomXsdList {
+  construct { initialize (typeof (GomXsdTypeRestrictionEnumeration)); }
+}
+public class GXml.GomXsdListTypeRestrictionWhiteSpaces : GomXsdList {
+  construct { initialize (typeof (GomXsdTypeRestrictionWhiteSpace)); }
+}
diff --git a/gxml/Schema.vala b/gxml/Schema.vala
index 1d0790b..729cf23 100644
--- a/gxml/Schema.vala
+++ b/gxml/Schema.vala
@@ -49,42 +49,52 @@ public interface GXml.XsdSimpleType: Object, DomElement, XsdBaseType {
   public abstract string id { get; set; }
   public abstract string name { get; set; }
   public abstract XsdAnnotation annotation { get; set; }
-  public abstract XsdSimpleTypeDefinition definition { get; set; }
+  public abstract XsdTypeList list { get; set; }
+  public abstract XsdTypeUnion union { get; set; }
+  public abstract XsdTypeRestriction restriction { get; set; }
 }
-public interface GXml.XsdSimpleTypeDefinition : Object {}
-public interface GXml.XsdTypeRestriction : Object, XsdSimpleTypeDefinition {
+public interface GXml.XsdTypeDef : Object {}
+public interface GXml.XsdTypeRestriction : Object, XsdTypeDef {
+  public const string SCHEMA_NODE_NAME = "restriction";
   public abstract string base { get; set; }
   public abstract string id { get; set; }
   public abstract XsdSimpleType simple_type { get; set; }
-  /**
-   * List of {link XsdTypeRestrictionDefinition} objects
-   */
-  public abstract XsdList definition { get; set; }
+  // TODO: Add all other definitons: like MinExclusive and others
+  public abstract XsdListTypeRestrictionEnumerations enumerations { get; set; }
+  public abstract XsdListTypeRestrictionWhiteSpaces white_spaces { get; set; }
 }
-public interface GXml.XsdTypeList: Object {}
-public interface GXml.XsdTypeUnion : Object {}
+public interface GXml.XsdTypeList: Object, XsdTypeDef {}
+public interface GXml.XsdTypeUnion : Object, XsdTypeDef {}
 
-public interface GXml.XsdTypeRestrictionDefinition : Object {
+public interface GXml.XsdTypeRestrictionDef : Object {
   public abstract XsdAnnotation annotation { get; set; }
 }
-public interface GXml.XsdTypeRestrictionMinExclusive : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionMinInclusive : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionMaxExclusive : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionMaxInclusive : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionTotalDigits : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionFractionDigits : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionLength : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionMinLength : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionMaxLength : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionEnumeration : Object, XsdTypeRestrictionDefinition {
+public interface GXml.XsdTypeRestrictionMinExclusive : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionMinInclusive : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionMaxExclusive : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionMaxInclusive : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionTotalDigits : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionFractionDigits : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionLength : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionMinLength : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionMaxLength : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionEnumeration : Object, XsdTypeRestrictionDef {
   public const string SCHEMA_NODE_NAME = "enumeration";
   public abstract string id { get; set; }
   public abstract string value { get; set; }
 }
-public interface GXml.XsdTypeRestrictionWhiteSpace: Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionPattern : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionAssertion : Object, XsdTypeRestrictionDefinition {}
-public interface GXml.XsdTypeRestrictionExplicitTimezone : Object, XsdTypeRestrictionDefinition {}
+public interface GXml.XsdTypeRestrictionWhiteSpace: Object, XsdTypeRestrictionDef {
+  public const string SCHEMA_NODE_NAME = "whiteSpace";
+  public abstract bool fixed { get; set; default = false; }
+  public abstract string id { get; set; }
+  /**
+   * (collapse | preserve | replace)
+   */
+  public abstract string value { get; set; }
+}
+public interface GXml.XsdTypeRestrictionPattern : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionAssertion : Object, XsdTypeRestrictionDef {}
+public interface GXml.XsdTypeRestrictionExplicitTimezone : Object, XsdTypeRestrictionDef {}
 
 public interface GXml.XsdComplexType : Object, DomElement, XsdBaseType {
   public const string SCHEMA_NODE_NAME = "complexType";
@@ -127,7 +137,7 @@ public interface GXml.XsdExtension : Object, DomElement {
 }
 
 public interface GXml.XsdElement : Object, DomElement {
-  public const string SCHEMA_NODE_NAME = "simpleType";
+  public const string SCHEMA_NODE_NAME = "element";
   /**
   * attribute name = abstract
   */
@@ -171,10 +181,8 @@ public interface GXml.XsdElement : Object, DomElement {
    */
   public abstract string object_type { get; set; }
   public abstract XsdAnnotation anotation { get; set; }
-  /**
-   * A {@link XsdComplexType} or {@link XsdSimpleType} list of elements
-   */
-  public abstract XsdListBaseTypes type_definitions { get; set; }
+  public abstract XsdSimpleType simple_type { get; set; }
+  public abstract XsdComplexType complex_type { get; set; }
   // TODO: Missing: ((simpleType | complexType)?, alternative*, (unique | key | keyref)*))
 }
 
@@ -214,4 +222,6 @@ public interface GXml.XsdList : Object, GomCollection {
 
 public interface GXml.XsdListElements : Object, XsdList {}
 public interface GXml.XsdListSimpleTypes : Object, XsdList {}
-public interface GXml.XsdListBaseTypes : Object, XsdList {}
+public interface GXml.XsdListComplexTypes : Object, XsdList {}
+public interface GXml.XsdListTypeRestrictionEnumerations : Object, XsdList {}
+public interface GXml.XsdListTypeRestrictionWhiteSpaces : Object, XsdList {}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]