Daniel,
I have considered the report. While I admit, that isRestriction() should
return true, I do also believe, that it is too dangerous to fix this in
0.4: The change would affect almost all class generating code in the
JaxMe core.
I suggest, that you file a bug report in Jira. We'll fix that in the
HEAD branch, after 0.4 is out.
Jochen
Daniel Barclay wrote:
> For input like this:
>
> ...
> <xsd:complexType name="x" />
> ...
>
> when JaxMeXS creates an XSComplexType object, both
> isRestriction() and isExtension() return false.
>
> The XML Schema specification says:
>
> [Definition:] Except for a distinguished �ur-type definition�,
> every �type definition� is, by construction, either a �restriction�
> or an �extension� of some other type definition.
>
> Therefore, for type x, either isRestriction() should return true or
> isExtension() should return true.
>
> (Nothing in the documentation of methods isRestriction() and
> isExtension() says that they don't actually represent the concepts
> of restriction and extension from XML schema.
>
> (Actually, the documentation contains errors, referring to some elements
> even though the methods are on XSComplexType.)
>
>
> Attached in a test program that demonstrates the problem.
>
> This seems to apply to JaxMeXS in JaxMe 0.3.1, 0.4beta, and
> the current default CVS branch (HEAD?).
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> package test;
>
> import org.apache.ws.jaxme.xs.*;
> import org.apache.ws.jaxme.xs.parser.*;
> import org.apache.ws.jaxme.xs.xml.*;
> import org.xml.sax.*;
> import javax.xml.parsers.ParserConfigurationException;
>
>
> import java.io.*;
>
> public class CheckBug_NeitherRestrictedNorExtended
> {
>
>
>
> public static void main( String[] args )
> throws Exception
> {
> System.err.println( "Checking bug: both isRestriction() and"
> + " isExtension() return false..." );
> String schemaContent =
> " "
> + "<xsd:schema "
> + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
> + " xmlns:xsdi=\"http://www.w3.org/2001/XMLSchema-instance\" "
> + " xsdi:schemaLocation=\"http://www.w3.org/2001/XMLSchema "
> + " http://www.w3.org/2001/XMLSchema.xsd\" "
> + " > "
> + " <xsd:complexType name=\"x\" /> "
> + "</xsd:schema> "
> ;
>
> InputSource source =
> new InputSource( new ByteArrayInputStream(
> schemaContent.getBytes( "ASCII" ) ) );
> source.setSystemId( "someScheme://x/whatever");
>
> XSParser parser = new XSParser();
> XSSchema schema = parser.parse( source );
>
> XSType type = schema.getTypes()[ 0 ];
> XSComplexType complexType = type.getComplexType();
>
> /**
> Symptom:
> */
>
> if ( ! complexType.isRestriction()
> && ! complexType.isExtension() ) {
> System.err.println( "apparent bug still exists" );
> }
> else if ( complexType.isRestriction() == !
> complexType.isExtension() ) {
> System.err.println( "bug seems to be fixed" );
> }
> else {
> System.err.println( "bug has changed" );
> }
>
>
> } // main(...)
>
>
> } // class CheckBug_NeitherRestrictedNorExtended
>
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]