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