W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

XML Schemas as AS Object Model

From: Peter Seiderer <Peter.Seiderer@ciselant.de>
Date: Sat, 2 Mar 2002 14:10:24 +0100
To: www-dom@w3.org
Message-ID: <20020302141024.A1057@zodiak.ecademix.com>
Hello,
I am not shure about how a given XML Schema woul be represented as a
Abstract Schemas Object Model, see the following example:


XML Schema example:

<?xml version="1.0" encoding="iso-8859-1"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

 <xsd:element name="ElementA"  type="TypeA"/>

  <xsd:complexType name="TypeA">
   <xsd:sequence>
    <xsd:element name="ElementB1"  type="TypeB" minOccurs="1" maxOccurs="1"/>
    <xsd:element name="ElementB2"  type="TypeB" minOccurs="0" maxOccurs="1"/>
   </xsd:sequence>
   <xsd:attribute name="AttributeA1" type="xsd:string"/>
   <xsd:attribute name="AttributeA2" type="xsd:string"/>
  </xsd:complexType>

  <xsd:complexType name="TypeB">
   <xsd:sequence>
    <xsd:element name="Text"  type="xsd:string"/>
   </xsd:sequence>
  </xsd:complexType>

</xsd:schema>


Abstract Schemas Object Model:

ASElementDecl example = {
	       strictMixedContent = false;
	       elemntType         = STRING_DATATYPE;
	       isPCDataOnly       = false;
	       contentType        = ELEMENTS_CONTENTTYPE;
	       ASContentModel     = exE
	       ASAttributeDecls   = null;
}

ASContentModel exE = {
	       listOperator = AS_SEQUENCE;
	       minOccurs = 1;
	       maxOccurs = 1;
	       subModeld = {(ASElementDecl ElementA)};
}

ASElementDecl ElementA = {
	       strictMixedContent    = false;
               elementType           = STRING_DATATYPE;
               isPCDataOnly          = false;
               contentType           = ELEMENTS_CONTENTTYPE;
               ASContentModel        = TypeA;
               ASAttributeDecls      = null;
}

ASContentModel TypeA = {
               listOperator          = AS_SEQUENCE;
               minOccurs             = 1;
               maxOccurs             = 1;
               subModels             = {(ASElementDecl ElementB1),
                                        (ASElementDecl ElementB2)};
}

ASElementDecl ElementB1 = {
	       strictMixedContent    = false;
               elementType           = STRING_DATATYPE;
               isPCDataOnly          = false;
               contentType           = ELEMENTS_CONTENTTYPE;
               ASContentModel        = TypeB;
               ASAttributeDecls      = null;
}

ASContentModel TypeB = {
               listOperator          = AS_SEQUENCE;
               minOccurs             = 1;
               maxOccurs             = 1;
               subModels             = {(ASElementDecl Text)};
}

 - Q1: But how is Elemnt B2 represented, because ASContentModel TypeB has the
       false minOccurs, maxOccurs values?

ASElementDecl ElementB2 = {
	       strictMixedContent    = false;
               elementType           = STRING_DATATYPE;
               isPCDataOnly          = false;
               contentType           = ELEMENTS_CONTENTTYPE;
               ASContentModel        = TypeB;
               ASAttributeDecls      = null;
}

 - Q2: Where to store the ASAttributeDecl AttributeA1 and AttributeA2 defined
       in the complexType TypeA, but in AS only ASElementDecl has the attribute
       ASAttributeDecls?

Thank you for your help in advance,
 Peter Seiderer

-- 
------------------------------------------------------------------------
Peter Seiderer                     E-Mail:  Peter.Seiderer@ciselant.de
Received on Saturday, 2 March 2002 08:06:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:55 GMT