5 Replies Latest reply on Feb 16, 2009 7:43 AM by Claus Ibsen

    Duplicate XML choice groups in camel-spring.xsd

    Oliver Newell Newbie

      Hi -

       

      Scanning the camel-spring.xsd schema, I notice there is a fair amount of duplication of the expression and processor choice groups. Attached is a modified version of the schema that uses XML groups to make it easier to maintain.

       

      All my Spring camelContext.xml files continue to validate with this schema, but more testing is certainly warranted!

       

      -Oliver

        • 1. Re: Duplicate XML choice groups in camel-spring.xsd
          Claus Ibsen Master

          Hi

           

          Thanks for the file.

           

          However the camel spring xsd file is auto generated based on JAXB annotations on the camel type models.

           

          Since its auto generated we cant maintain it manually. I guess that are are always pluses/minuses using such an approach.

          • 2. Re: Duplicate XML choice groups in camel-spring.xsd
            Oliver Newell Newbie

            Thanks - I was looking at the Camel source after I posted my XSD file, and I wondered if it was being auto-generated after I saw the annotations in the model (So far all my work has been auto-generating Java code from XSDs, so I haven't have experience with doing things from the other direction).

             

            On a related topic, is there a way to add annotations to the Java code that end up propagating to  elements in the XSD?  It seems like that would be a useful feature since then that information would be accessible in schema aware editors (like Oxygen). I do find that handy in the case of the spring-beans-2.5.xsd schema.

             

            -Oliver

            • 3. Re: Duplicate XML choice groups in camel-spring.xsd
              Claus Ibsen Master

              Oliver

               

              Do you care to elaborate a bit on this?

              • 4. Re: Duplicate XML choice groups in camel-spring.xsd
                Oliver Newell Newbie

                Sure -

                 

                In the spring-beans-2.5.xsd schema, there are XML annotations on elements, and the annotations are visible in Xml Editors.  Just an extra bit of documentation that can come in handy.  Here's one of the fragments from spring-beans-2.5.xsd.

                 

                  <xsd:attribute name="default-autowire-candidates" type="xsd:string">

                             <xsd:annotation>

                                <xsd:documentation><![CDATA[

                        A default bean name pattern for identifying autowire candidates:

                        e.g. "Service", "data", "Service", "data*Service".

                        Also accepts a comma-separated list of patterns: e.g. "Service,Dao".

                        See the documentation for the 'autowire-candidate' attribute of the

                        '<bean/>' element for the semantic details of autowire candidate beans.

                              ]]></xsd:documentation>

                           </xsd:annotation>

                   </xsd:attribute>

                 

                I'm not that familiar with Java Annotations and JAXB, so I was just wondering if there was a mechanism to transpose in-line documentation in the Java classes to the generated  XML classes.  Not a big deal...just curious if it was possible.

                 

                -Oliver

                • 5. Re: Duplicate XML choice groups in camel-spring.xsd
                  Claus Ibsen Master

                  Hi

                   

                  Cool the xsd:documentation is something that would be great to get into the XSD.

                   

                  I think we have a ticket about this in the Apache JIRA.

                   

                  However the maven tool that does the code -> xsd generator is done some years ago and it had to do a few hacks because of the JAXB implementation in Java had some flaws at the time.

                   

                  So the tool is not something we have updated for some time. Would be cool if the tool could grab the class javadoc and use it for the xsd documentation.

                   

                  With javadoc you get the benefit of the same documentation for both the Java and XML DSL at once.