Generating classes from XSD file












0














I'm trying to generate Java classes from spring-beans.xsd by using JAXB (training purposes only) and I've got this error:



parsing a schema...
[ERROR] Property "Ref" is already defined. Use <jaxb:property> to resolve this conflict.
line 582 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 622 of file:/C:/spring-beans.xsd

[ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict.
line 584 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 629 of file:/C:/spring-beans.xsd

[ERROR] Property "Key" is already defined. Use <jaxb:property> to resolve this conflict.
line 1135 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1138 of file:/C:/spring-beans.xsd

[ERROR] Property "Ref" is already defined. Use <jaxb:property> to resolve this conflict.
line 1052 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1071 of file:/C:/spring-beans.xsd

[ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict.
line 1054 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1078 of file:/C:/spring-beans.xsd

Failed to parse a schema.


What's wrong? Thanks for any help in advance.










share|improve this question
























  • You want us to tell you what's wrong with your schema without seeing the schema? We're not mind-readers.
    – Michael Kay
    Nov 21 '18 at 20:41










  • Click the link.
    – Wojtek
    Nov 21 '18 at 22:56










  • So it's a valid schema that your JAXB software can't handle. Sorry, I don't know JAXB well enough to help you.
    – Michael Kay
    Nov 22 '18 at 11:00










  • Well, thanks for trying, anyways.
    – Wojtek
    Nov 22 '18 at 11:07
















0














I'm trying to generate Java classes from spring-beans.xsd by using JAXB (training purposes only) and I've got this error:



parsing a schema...
[ERROR] Property "Ref" is already defined. Use <jaxb:property> to resolve this conflict.
line 582 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 622 of file:/C:/spring-beans.xsd

[ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict.
line 584 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 629 of file:/C:/spring-beans.xsd

[ERROR] Property "Key" is already defined. Use <jaxb:property> to resolve this conflict.
line 1135 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1138 of file:/C:/spring-beans.xsd

[ERROR] Property "Ref" is already defined. Use <jaxb:property> to resolve this conflict.
line 1052 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1071 of file:/C:/spring-beans.xsd

[ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict.
line 1054 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1078 of file:/C:/spring-beans.xsd

Failed to parse a schema.


What's wrong? Thanks for any help in advance.










share|improve this question
























  • You want us to tell you what's wrong with your schema without seeing the schema? We're not mind-readers.
    – Michael Kay
    Nov 21 '18 at 20:41










  • Click the link.
    – Wojtek
    Nov 21 '18 at 22:56










  • So it's a valid schema that your JAXB software can't handle. Sorry, I don't know JAXB well enough to help you.
    – Michael Kay
    Nov 22 '18 at 11:00










  • Well, thanks for trying, anyways.
    – Wojtek
    Nov 22 '18 at 11:07














0












0








0







I'm trying to generate Java classes from spring-beans.xsd by using JAXB (training purposes only) and I've got this error:



parsing a schema...
[ERROR] Property "Ref" is already defined. Use <jaxb:property> to resolve this conflict.
line 582 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 622 of file:/C:/spring-beans.xsd

[ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict.
line 584 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 629 of file:/C:/spring-beans.xsd

[ERROR] Property "Key" is already defined. Use <jaxb:property> to resolve this conflict.
line 1135 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1138 of file:/C:/spring-beans.xsd

[ERROR] Property "Ref" is already defined. Use <jaxb:property> to resolve this conflict.
line 1052 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1071 of file:/C:/spring-beans.xsd

[ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict.
line 1054 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1078 of file:/C:/spring-beans.xsd

Failed to parse a schema.


What's wrong? Thanks for any help in advance.










share|improve this question















I'm trying to generate Java classes from spring-beans.xsd by using JAXB (training purposes only) and I've got this error:



parsing a schema...
[ERROR] Property "Ref" is already defined. Use <jaxb:property> to resolve this conflict.
line 582 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 622 of file:/C:/spring-beans.xsd

[ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict.
line 584 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 629 of file:/C:/spring-beans.xsd

[ERROR] Property "Key" is already defined. Use <jaxb:property> to resolve this conflict.
line 1135 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1138 of file:/C:/spring-beans.xsd

[ERROR] Property "Ref" is already defined. Use <jaxb:property> to resolve this conflict.
line 1052 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1071 of file:/C:/spring-beans.xsd

[ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict.
line 1054 of file:/C:/spring-beans.xsd

[ERROR] The following location is relevant to the above error
line 1078 of file:/C:/spring-beans.xsd

Failed to parse a schema.


What's wrong? Thanks for any help in advance.







xml xsd jaxb xjc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 21:54









Thomas Fritsch

5,031121933




5,031121933










asked Nov 21 '18 at 18:44









WojtekWojtek

184




184












  • You want us to tell you what's wrong with your schema without seeing the schema? We're not mind-readers.
    – Michael Kay
    Nov 21 '18 at 20:41










  • Click the link.
    – Wojtek
    Nov 21 '18 at 22:56










  • So it's a valid schema that your JAXB software can't handle. Sorry, I don't know JAXB well enough to help you.
    – Michael Kay
    Nov 22 '18 at 11:00










  • Well, thanks for trying, anyways.
    – Wojtek
    Nov 22 '18 at 11:07


















  • You want us to tell you what's wrong with your schema without seeing the schema? We're not mind-readers.
    – Michael Kay
    Nov 21 '18 at 20:41










  • Click the link.
    – Wojtek
    Nov 21 '18 at 22:56










  • So it's a valid schema that your JAXB software can't handle. Sorry, I don't know JAXB well enough to help you.
    – Michael Kay
    Nov 22 '18 at 11:00










  • Well, thanks for trying, anyways.
    – Wojtek
    Nov 22 '18 at 11:07
















You want us to tell you what's wrong with your schema without seeing the schema? We're not mind-readers.
– Michael Kay
Nov 21 '18 at 20:41




You want us to tell you what's wrong with your schema without seeing the schema? We're not mind-readers.
– Michael Kay
Nov 21 '18 at 20:41












Click the link.
– Wojtek
Nov 21 '18 at 22:56




Click the link.
– Wojtek
Nov 21 '18 at 22:56












So it's a valid schema that your JAXB software can't handle. Sorry, I don't know JAXB well enough to help you.
– Michael Kay
Nov 22 '18 at 11:00




So it's a valid schema that your JAXB software can't handle. Sorry, I don't know JAXB well enough to help you.
– Michael Kay
Nov 22 '18 at 11:00












Well, thanks for trying, anyways.
– Wojtek
Nov 22 '18 at 11:07




Well, thanks for trying, anyways.
– Wojtek
Nov 22 '18 at 11:07












1 Answer
1






active

oldest

votes


















0














The problem is that in each case you have two XML items - an element like



<xsd:element ref="ref"/>


and an attribute like



<xsd:attribute name="ref" type="xsd:string"/>


in the same complex type. They both map by default to properties named Ref. But since these two XML items are different things, JAXB complains about naming conflict.



The solution is normally quite simple (and actually suggested by the error log).
Customize one of the properties using jaxb:property binding. Something along the lines:



<jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<jaxb:bindings
schemaLocation="spring-beans.xsd"
node="/xs:schema">
<jaxb:bindings node="xs:element[@name='constructor-arg']/xs:complexType/xs:attribute[@name='ref']">
<jaxb:property name="aRef"/>
</jaxb:bindings>
</jaxb:bindings>

</jaxb:bindings>





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418679%2fgenerating-classes-from-xsd-file%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The problem is that in each case you have two XML items - an element like



    <xsd:element ref="ref"/>


    and an attribute like



    <xsd:attribute name="ref" type="xsd:string"/>


    in the same complex type. They both map by default to properties named Ref. But since these two XML items are different things, JAXB complains about naming conflict.



    The solution is normally quite simple (and actually suggested by the error log).
    Customize one of the properties using jaxb:property binding. Something along the lines:



    <jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <jaxb:bindings
    schemaLocation="spring-beans.xsd"
    node="/xs:schema">
    <jaxb:bindings node="xs:element[@name='constructor-arg']/xs:complexType/xs:attribute[@name='ref']">
    <jaxb:property name="aRef"/>
    </jaxb:bindings>
    </jaxb:bindings>

    </jaxb:bindings>





    share|improve this answer


























      0














      The problem is that in each case you have two XML items - an element like



      <xsd:element ref="ref"/>


      and an attribute like



      <xsd:attribute name="ref" type="xsd:string"/>


      in the same complex type. They both map by default to properties named Ref. But since these two XML items are different things, JAXB complains about naming conflict.



      The solution is normally quite simple (and actually suggested by the error log).
      Customize one of the properties using jaxb:property binding. Something along the lines:



      <jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
      xmlns:xs="http://www.w3.org/2001/XMLSchema">

      <jaxb:bindings
      schemaLocation="spring-beans.xsd"
      node="/xs:schema">
      <jaxb:bindings node="xs:element[@name='constructor-arg']/xs:complexType/xs:attribute[@name='ref']">
      <jaxb:property name="aRef"/>
      </jaxb:bindings>
      </jaxb:bindings>

      </jaxb:bindings>





      share|improve this answer
























        0












        0








        0






        The problem is that in each case you have two XML items - an element like



        <xsd:element ref="ref"/>


        and an attribute like



        <xsd:attribute name="ref" type="xsd:string"/>


        in the same complex type. They both map by default to properties named Ref. But since these two XML items are different things, JAXB complains about naming conflict.



        The solution is normally quite simple (and actually suggested by the error log).
        Customize one of the properties using jaxb:property binding. Something along the lines:



        <jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema">

        <jaxb:bindings
        schemaLocation="spring-beans.xsd"
        node="/xs:schema">
        <jaxb:bindings node="xs:element[@name='constructor-arg']/xs:complexType/xs:attribute[@name='ref']">
        <jaxb:property name="aRef"/>
        </jaxb:bindings>
        </jaxb:bindings>

        </jaxb:bindings>





        share|improve this answer












        The problem is that in each case you have two XML items - an element like



        <xsd:element ref="ref"/>


        and an attribute like



        <xsd:attribute name="ref" type="xsd:string"/>


        in the same complex type. They both map by default to properties named Ref. But since these two XML items are different things, JAXB complains about naming conflict.



        The solution is normally quite simple (and actually suggested by the error log).
        Customize one of the properties using jaxb:property binding. Something along the lines:



        <jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
        xmlns:xs="http://www.w3.org/2001/XMLSchema">

        <jaxb:bindings
        schemaLocation="spring-beans.xsd"
        node="/xs:schema">
        <jaxb:bindings node="xs:element[@name='constructor-arg']/xs:complexType/xs:attribute[@name='ref']">
        <jaxb:property name="aRef"/>
        </jaxb:bindings>
        </jaxb:bindings>

        </jaxb:bindings>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 '18 at 21:38









        lexicorelexicore

        30.9k882154




        30.9k882154






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418679%2fgenerating-classes-from-xsd-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            TypeError: fit_transform() missing 1 required positional argument: 'X'