8 Replies Latest reply on Apr 3, 2006 10:32 AM by aloubyansky

    Anonymous type QNames

    starksm64

      Related to http://jira.jboss.com/jira/browse/JBXB-58, how do we handle the type for an anonymous type? In the JBXB-58 case, the attribute type is a restricted enumeration of the xs:string type. The javadoc for the org.xml.sax.helpers.AttributesImpl does not say anything about how the type is used, and its not used by the jbossxb layer currently. To work around the current NPE I added a check of the type name and if its null, default to CDATA which is the type I saw if the access attribute was specified. We may need to expand this to a more intelligent value in the future or create a better type in the XsdBinder.bindSimpleType.

        • 1. Re: Anonymous type QNames

          The default type for an attribute should be xs:anySimpleType

          • 2. Re: Anonymous type QNames
            starksm64

            We can't just assume the anySimpleType "http://www.w3.org/2001/XMLSchema" namespace prefix is xs. Is there a method in the jbossxb layer that allows one to obtain the correct qname for a standard type local name?

            • 3. Re: Anonymous type QNames

              org.jboss.xb.binding.NamespaceRegistry

              • 4. Re: Anonymous type QNames
                starksm64

                This does not appear to be exposed to the TypeBinding for the attribute. It is passed to the startParticle which calls the TypeBinding.expandWithDefaultAttributes, but it is not propagated. The only uses of expandWithDefaultAttributes are from jbossxb code, so this could be added without breaking anything it appears.

                • 5. Re: Anonymous type QNames

                  I already talked to Alex about this back in January.

                  Ideally, rather than having these "arbitary" parameters passed
                  around in different api, there should be a ParserContext object
                  that holds all of these helpers and other context.

                  • 6. Re: Anonymous type QNames
                    starksm64

                    This issue of having to deal with the weakly defined type binding throughout the jbossxb codebase is an example of a complexity issue I would like to deal with in the refactoring. When we create a type binding, why can't it be a self contained object that encpasulates any reference to inhereted types, etc.

                    • 7. Re: Anonymous type QNames
                      starksm64

                       

                      "adrian@jboss.org" wrote:
                      I already talked to Alex about this back in January.

                      Ideally, rather than having these "arbitary" parameters passed
                      around in different api, there should be a ParserContext object
                      that holds all of these helpers and other context.

                      Agreed.


                      • 8. Re: Anonymous type QNames
                        aloubyansky

                        According to Javadoc for Attributes.getType(i):

                        "javadoc" wrote:
                        The attribute type is one of the strings "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", or "NOTATION" (always in upper case).


                        For now, we are going to use CDATA in this case.