For input like this:

    ...
    <xsd:attribute name="global" />
    <xsd:complexType name="x">
      <xsd:attribute ref="global" />
    ...

when JaxMeXS creates an XSAttribute object, isGlobal() returns false.



Attached is 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?).

Daniel






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_GlobalAttributeMarkedLocal
{


    public static void main( String[] args )
        throws Exception
    {
        System.err.println( "Checking bug: global attribute not marked 
global..." );
        String schemaContent =
            ""
            + "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "
            + "<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\"; "
            + "  xmlns=\"urn:xxx\" "
            + "  targetNamespace=\"urn:xxx\" "
            + "  elementFormDefault=\"qualified\" "
            + "  attributeFormDefault=\"unqualified\" "
            + "  > "
            + " "
            + "  <xsd:attribute name=\"global\" type=\"xsd:integer\" /> "
            + "  <xsd:element name=\"global\" type=\"xsd:integer\" /> "
            + " "
            + " "
            + "    <xsd:complexType name=\"x\"> "
            + "      <xsd:sequence> "
            + "        <xsd:element ref=\"global\" /> "
            + "        <xsd:element name=\"local\" /> "
            + "      </xsd:sequence> "
            + "      <xsd:attribute ref=\"global\" /> "
            + "      <xsd:attribute name=\"local\" /> "
            + "    </xsd:complexType> "
            + " "
            + "</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();
            XSAttributable[] attributes = complexType.getAttributes();
            XSAttribute globalAttributeUse = (XSAttribute) attributes[ 0 ];


            /**
               Symptom:  For use of a global attribute, on the XSAttribute
               object isGlobal does not return true as it should.
             */

            if ( globalAttributeUse.isGlobal() ) {
                System.err.println( "bug seems to be fixed" );
            }
            else {
                System.err.println( "apparent bug still exists" );
            }

                
    } // main(...)


} // class CheckBug_GlobalAttributeMarkedLocal



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to