[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-j-user
Subject:    Re: Fw: Re: Representation of complex types derived by extension
From:       Michael Glavassevich <mrglavas () ca ! ibm ! com>
Date:       2010-10-10 21:34:28
Message-ID: OF1D8C3ADA.29222064-ON852577B8.0075E9E7-852577B8.007683AA () ca ! ibm ! com
[Download RAW message or body]

Have you actually tried this out? I wouldn't expect that the spec allows
you to do this except for the corner case where the base type is empty.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Michael Glavassevich <mrglavas@ca.ibm.com> wrote on 10/10/2010 05:20:32 PM:

> (Forwarding a message from Jeff Greif to the list that got lost in
> the moderation queue.)
>
> ----- Message from Jeff Greif <jgreif@alumni.princeton.edu> on Tue,
> 28 Sep 2010 10:13:16 -0700 -----
>
> > Thanks very much, Michael.
> >
> > Related questions:
> >
> > If there is
> >
> > <extension base="X">
> >     <all>...</all>
> > </extension>
> >
> > I would expect that either X has no element content or a content model
> > of <all>, with some compatibility constraint between the <all>
> > particles of base and extension.  Since <sequence> must not have an
> > <all> child, presumably the {content type} must be modeled as a pair
> > containing a particle with {all} term.
> >
> > 1.  must X have empty element content or is something else possible?
> >
> > 2.  is the element-content part of {content type} represented as a
> > particle with a single {all} term?
> >
> > Jeff
> >
> > On Sat, Sep 18, 2010 at 2:19 PM, Michael Glavassevich
> > <mrglavas@ca.ibm.com> wrote:
> > > Hi Jeff,
> > >
> > > What you are getting from the XSModel is consistent with the
definition of
> > > the {content type} in the XML Schema 1.0 spec. For an extension it's
a
> > > sequence of two particles; a particle for the base content followed
by a
> > > particle containing the effective content [1] from the
> extension. Below the
> > > anchor [1] you'll see the formal definition in 3.2.3.
> > >
> > > Thanks.
> > >
> > > [1] http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#key-exg
> > >
> > > Michael Glavassevich
> > > XML Parser Development
> > > IBM Toronto Lab
> > > E-mail: mrglavas@ca.ibm.com
> > > E-mail: mrglavas@apache.org
> > >
> > > Jeff Greif <jeff.greif@gmail.com> wrote on 09/18/2010 01:35:46 AM:
> > >
> > >> When using the Xerces 2.8.1 XML Schema API, the derived type from
this
> > >> schema:
> > >>
> > >> <?xml version="1.0" ?>
> > >> <schema xmlns="http://www.w3.org/2001/XMLSchema"
> > >>         targetNamespace="urn:webalo:try-extension"
> > >>         xmlns:tns="urn:webalo:try-extension">
> > >>
> > >>     <element name="root" type="tns:Derived"/>
> > >>
> > >>     <complexType name="Base">
> > >>         <sequence>
> > >>             <element name="a" type="string"/>
> > >>             <element name="b" type="string"/>
> > >>         </sequence>
> > >>     </complexType>
> > >>
> > >>     <complexType name="Derived">
> > >>         <complexContent>
> > >>             <extension base="tns:Base">
> > >>                 <sequence>
> > >>                     <element name="c" type="string"/>
> > >>                     <element name="d" type="string"/>
> > >>                     <element name="e" type="string"/>
> > >>                 </sequence>
> > >>             </extension>
> > >>         </complexContent>
> > >>     </complexType>
> > >> </schema>
> > >>
> > >> is represented in that API as though it had content model:
> > >>
> > >>     <complexType name="Derived">
> > >>    <sequence>
> > >>           <sequence>
> > >>             <element name="a" type="string"/>
> > >>             <element name="b" type="string"/>
> > >>           </sequence>
> > >>      <sequence>
> > >>             <element name="c" type="string"/>
> > >>             <element name="d" type="string"/>
> > >>             <element name="e" type="string"/>
> > >>           </sequence>
> > >>        </sequence>
> > >>     </complexType>
> > >>
> > >> rather than what I would have naively thought:
> > >>
> > >>     <complexType name="Derived">
> > >>    <sequence>
> > >>             <element name="a" type="string"/>
> > >>             <element name="b" type="string"/>
> > >>             <element name="c" type="string"/>
> > >>             <element name="d" type="string"/>
> > >>             <element name="e" type="string"/>
> > >>        </sequence>
> > >>     </complexType>
> > >>
> > >> That is, the XSModelGroup representing the content of the type has
two
> > >> particles, each of which has a term which is an XSModelGroup, one
with
> > >> two and one with three particles.
> > >>
> > >> I have a test program to demonstrate this, if it is needed.
> > >>
> > >> Is this expected behavior and is it documented somewhere?
> > >>
> > >> What I've found elsewhere includes:
> > >>
> > >> a.  "A complex type which extends another does so by having
additional
> > >> content model particles at the end of the other definition's content
> > >> model, or by having additional attribute declarations, or both."
> > >>
> > >> from XML Schema 1.0 Second Edition, section 2.2.1.3, which seems to
> > >> suggest the form I had expected.
> > >>
> > >> b.  On the other hand, the infoset description, 3.4.1 which suggests
> > >> there is a separate "base type definition" and "content type" which
> > >> contains a content model, which could suggest the nested form found
in
> > >> my test.
> > >>
> > >> c.  The documentation for the XSComplexTypeDefinition.getParticle()
> > >> method refers to "A particle for a mixed or element-only content
> > >> model...".
> > >>
> > >> Thanks for any illumination.
> > >>
> > >> Jeff
> > >>
> > >>
> > >>
---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > >> For additional commands, e-mail: j-users-help@xerces.apache.org
[Attachment #3 (text/html)]

<html><body>
<p><tt>Have you actually tried this out? I wouldn't expect that the spec allows you \
to do this except for the corner case where the base type is empty.</tt><br> <br>
<tt>Thanks.</tt><br>
<br>
<tt>Michael Glavassevich<br>
XML Parser Development<br>
IBM Toronto Lab<br>
E-mail: mrglavas@ca.ibm.com</tt><br>
<tt>E-mail: mrglavas@apache.org</tt><br>
<br>
<tt>Michael Glavassevich &lt;mrglavas@ca.ibm.com&gt; wrote on 10/10/2010 05:20:32 \
PM:<br> <br>
&gt; (Forwarding a message from Jeff Greif to the list that got lost in <br>
&gt; the moderation queue.)<br>
&gt; <br>
&gt; ----- Message from Jeff Greif &lt;jgreif@alumni.princeton.edu&gt; on Tue, <br>
&gt; 28 Sep 2010 10:13:16 -0700 -----<br>
&gt; &nbsp;<br>
&gt; &gt; Thanks very much, Michael.<br>
&gt; &gt; <br>
&gt; &gt; Related questions:<br>
&gt; &gt; <br>
&gt; &gt; If there is<br>
&gt; &gt; <br>
&gt; &gt; &lt;extension base=&quot;X&quot;&gt;<br>
&gt; &gt; &nbsp; &nbsp; &lt;all&gt;...&lt;/all&gt;<br>
&gt; &gt; &lt;/extension&gt;<br>
&gt; &gt; <br>
&gt; &gt; I would expect that either X has no element content or a content model<br>
&gt; &gt; of &lt;all&gt;, with some compatibility constraint between the \
&lt;all&gt;<br> &gt; &gt; particles of base and extension. &nbsp;Since \
&lt;sequence&gt; must not have an<br> &gt; &gt; &lt;all&gt; child, presumably the \
{content type} must be modeled as a pair<br> &gt; &gt; containing a particle with \
{all} term.<br> &gt; &gt; <br>
&gt; &gt; 1. &nbsp;must X have empty element content or is something else \
possible?<br> &gt; &gt; <br>
&gt; &gt; 2. &nbsp;is the element-content part of {content type} represented as a<br>
&gt; &gt; particle with a single {all} term?<br>
&gt; &gt; <br>
&gt; &gt; Jeff<br>
&gt; &gt; <br>
&gt; &gt; On Sat, Sep 18, 2010 at 2:19 PM, Michael Glavassevich<br>
&gt; &gt; &lt;mrglavas@ca.ibm.com&gt; wrote:<br>
&gt; &gt; &gt; Hi Jeff,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; What you are getting from the XSModel is consistent with the \
definition of<br> &gt; &gt; &gt; the {content type} in the XML Schema 1.0 spec. For \
an extension it's a<br> &gt; &gt; &gt; sequence of two particles; a particle for the \
base content followed by a<br> &gt; &gt; &gt; particle containing the effective \
content [1] from the <br> &gt; extension. Below the<br>
&gt; &gt; &gt; anchor [1] you'll see the formal definition in 3.2.3.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Thanks.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; [1] <a \
href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#key-exg">http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#key-exg</a><br>
 &gt; &gt; &gt;<br>
&gt; &gt; &gt; Michael Glavassevich<br>
&gt; &gt; &gt; XML Parser Development<br>
&gt; &gt; &gt; IBM Toronto Lab<br>
&gt; &gt; &gt; E-mail: mrglavas@ca.ibm.com<br>
&gt; &gt; &gt; E-mail: mrglavas@apache.org<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Jeff Greif &lt;jeff.greif@gmail.com&gt; wrote on 09/18/2010 01:35:46 \
AM:<br> &gt; &gt; &gt;<br>
&gt; &gt; &gt;&gt; When using the Xerces 2.8.1 XML Schema API, the derived type from \
this<br> &gt; &gt; &gt;&gt; schema:<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; &lt;?xml version=&quot;1.0&quot; ?&gt;<br>
&gt; &gt; &gt;&gt; &lt;schema xmlns=&quot;http://www.w3.org/2001/XMLSchema&quot;<br>
&gt; &gt; &gt;&gt;         targetNamespace=&quot;urn:webalo:try-extension&quot;<br>
&gt; &gt; &gt;&gt;         xmlns:tns=&quot;urn:webalo:try-extension&quot;&gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;     &lt;element name=&quot;root&quot; \
type=&quot;tns:Derived&quot;/&gt;<br> &gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;     &lt;complexType name=&quot;Base&quot;&gt;<br>
&gt; &gt; &gt;&gt;         &lt;sequence&gt;<br>
&gt; &gt; &gt;&gt;             &lt;element name=&quot;a&quot; \
type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;             &lt;element \
name=&quot;b&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;         \
&lt;/sequence&gt;<br> &gt; &gt; &gt;&gt;     &lt;/complexType&gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;     &lt;complexType name=&quot;Derived&quot;&gt;<br>
&gt; &gt; &gt;&gt;         &lt;complexContent&gt;<br>
&gt; &gt; &gt;&gt;             &lt;extension base=&quot;tns:Base&quot;&gt;<br>
&gt; &gt; &gt;&gt;                 &lt;sequence&gt;<br>
&gt; &gt; &gt;&gt;                     &lt;element name=&quot;c&quot; \
type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;                     &lt;element \
name=&quot;d&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;                \
&lt;element name=&quot;e&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;    \
&lt;/sequence&gt;<br> &gt; &gt; &gt;&gt;             &lt;/extension&gt;<br>
&gt; &gt; &gt;&gt;         &lt;/complexContent&gt;<br>
&gt; &gt; &gt;&gt;     &lt;/complexType&gt;<br>
&gt; &gt; &gt;&gt; &lt;/schema&gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; is represented in that API as though it had content model:<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;     &lt;complexType name=&quot;Derived&quot;&gt;<br>
&gt; &gt; &gt;&gt;    &lt;sequence&gt;<br>
&gt; &gt; &gt;&gt;           &lt;sequence&gt;<br>
&gt; &gt; &gt;&gt;             &lt;element name=&quot;a&quot; \
type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;             &lt;element \
name=&quot;b&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;           \
&lt;/sequence&gt;<br> &gt; &gt; &gt;&gt;      &lt;sequence&gt;<br>
&gt; &gt; &gt;&gt;             &lt;element name=&quot;c&quot; \
type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;             &lt;element \
name=&quot;d&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;             \
&lt;element name=&quot;e&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;    \
&lt;/sequence&gt;<br> &gt; &gt; &gt;&gt;        &lt;/sequence&gt;<br>
&gt; &gt; &gt;&gt;     &lt;/complexType&gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; rather than what I would have naively thought:<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;     &lt;complexType name=&quot;Derived&quot;&gt;<br>
&gt; &gt; &gt;&gt;    &lt;sequence&gt;<br>
&gt; &gt; &gt;&gt;             &lt;element name=&quot;a&quot; \
type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;             &lt;element \
name=&quot;b&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;             \
&lt;element name=&quot;c&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;    \
&lt;element name=&quot;d&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;    \
&lt;element name=&quot;e&quot; type=&quot;string&quot;/&gt;<br> &gt; &gt; &gt;&gt;    \
&lt;/sequence&gt;<br> &gt; &gt; &gt;&gt;     &lt;/complexType&gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; That is, the XSModelGroup representing the content of the type has \
two<br> &gt; &gt; &gt;&gt; particles, each of which has a term which is an \
XSModelGroup, one with<br> &gt; &gt; &gt;&gt; two and one with three particles.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; I have a test program to demonstrate this, if it is needed.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Is this expected behavior and is it documented somewhere?<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; What I've found elsewhere includes:<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; a.  &quot;A complex type which extends another does so by having \
additional<br> &gt; &gt; &gt;&gt; content model particles at the end of the other \
definition's content<br> &gt; &gt; &gt;&gt; model, or by having additional attribute \
declarations, or both.&quot;<br> &gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; from XML Schema 1.0 Second Edition, section 2.2.1.3, which seems \
to<br> &gt; &gt; &gt;&gt; suggest the form I had expected.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; b.  On the other hand, the infoset description, 3.4.1 which \
suggests<br> &gt; &gt; &gt;&gt; there is a separate &quot;base type definition&quot; \
and &quot;content type&quot; which<br> &gt; &gt; &gt;&gt; contains a content model, \
which could suggest the nested form found in<br> &gt; &gt; &gt;&gt; my test.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; c.  The documentation for the \
XSComplexTypeDefinition.getParticle()<br> &gt; &gt; &gt;&gt; method refers to &quot;A \
particle for a mixed or element-only content<br> &gt; &gt; &gt;&gt; \
model...&quot;.<br> &gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Thanks for any illumination.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Jeff<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; ---------------------------------------------------------------------<br>
 &gt; &gt; &gt;&gt; To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org<br>
&gt; &gt; &gt;&gt; For additional commands, e-mail: \
j-users-help@xerces.apache.org</tt></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic