Hi David,

The schema you've attached is invalid. The value of the "ref" attribute is
a QName. Since you have no declaration for the default namespace (i.e.
xmlns="http://foo.com/#";) in your schema those QNames have no namespace and
thus point to nonexistent declarations which couldn't be referred to even
if they existed without a <xs:import>. If you give the XSLoader a broken
schema don't be surprised if you get a busted XSModel back. The behaviour
of such a model is undefined.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

<[EMAIL PROTECTED]> wrote on 11/13/2008 11:01:14 PM:

> In using Xerces2-J 2.9.0 to parse and query XML Schema components in
> memory (ref: http://xerces.apache.org/xerces2-j/faq-xs.html#faq-9),
> I have noticed what seems to be a bug when parsing the attached
> schema, test.xsl.
>
> The instance of org.apache.xerces.impl.xs.XSModelGroupImpl created
> for the fragment:
>             <xs:sequence>
>                 <xs:element ref="a"/>
>                 <xs:element ref="b" minOccurs="0" maxOccurs="1"/>
>                 <xs:element ref="c" minOccurs="1" maxOccurs="unbounded"/>
>             </xs:sequence>
> ...of test.xsl contains a ternary array XSParticleDecl[] fParticles
> containing instances for each of the three xs:element declarations
> in the sequence, however the corresponding fParticleCount attribute
> (recording the number of particles in fParticles) seems to have not
> been set, defaulting to 0.
>
> I discovered the problem via a call to getParticles() on org.apache.
> xerces.impl.xs.XSModelGroupImpl, which builds a new XSObjectListImpl
> via constructor XSObjectListImpl(XSObject[] array, int length),
> where array is set to fParticles and length to fParticleCount. Using
> fParticles.length for the latter (in this case) solves the problem.
> Attached is a test file to reproduce this behaviour.
>
> If someone can confirm this as a bug, I'll submit it... thanks!
>
> David

Reply via email to