- From: Benjamin C. Chang <Ben.Chang@oracle.com>
- Date: Wed, 06 Mar 2002 16:11:24 -0800
- To: Peter Seiderer <Peter.Seiderer@ciselant.de>
- CC: www-dom@w3.org
Peter Seiderer wrote: > 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? TypeA should be: ASContentModel TypeA = { contentModelType = SEQUENCE_CM; minOccurs = 1; maxOccurs = 1; subModels = {(ASContentModel exB1), (ASContentModel exB2), (ASAttributeDecl attr1), (ASAttributeDecl attr2)}; }; ASContentModel exB1 = { contentModelType = SEQUENCE_CM; minOccurs = 1; maxOccurs = 1; subModels = {(ASElementDecl B1)}; } ASElementDecl B1 = { ... ASContentModel = TypeB; ... } ASContentModel exB2 { contentModelType = SEQUENCE_CM; minOccurs = 0; maxOccurs = 1; subModels = {(ASElementDecl B2)}; } ASElementDecl B2 = { ... ASContentModel = TypeB; ... } > > > 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? subModels contains a list of ASObjects, so in addition to ASElementDecl, it can also contain ASAttributeDecls (see above). Hope this helps, Ben > > > Thank you for your help in advance, > Peter Seiderer > > -- > ------------------------------------------------------------------------ > Peter Seiderer E-Mail: Peter.Seiderer@ciselant.de
Received on Wednesday, 6 March 2002 19:11:33 UTC