Getting a org.xml.sax.SAXParseException "is already defined"
See original GitHub issueI am getting the following Exceptions on my *.xsd files: link to error
It says that there is a double definition on line 47, with the first appearance being at line 10.
When looking at the file itself I don’t notice any double names. The line to which the exception occurs contains: <xs:complexType name="AfzenderAdresType">
while the “first definition” contains <xs:complexType name="OntvangerAdresType">
. (You can find the file itself here)
The both have similar but different names and their definition is nearly identical. What is going on here? Any help as to how I can fix this?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Generating JAXB class from XSDs with similar attribute names
Creating an XML element with xsi:nil and attributes in .Net/Jaxb. 0. XML XSD Error : org.xml.sax.SAXParseException: s4s-elt-schema-ns: The ...
Read more >(MJAXB-31) jaxb2:xjc throws "org.xml.sax.SAXParseException
jaxb2:xjc throws "org.xml.sax.SAXParseException: 'xyz' is already defined" on schema files located in directories with embedded tilde character
Read more >trying to use seperate schema compilation using maven-jaxb2 ...
sax.SAXParseException: 'address' is already defined'. Hopes this helps. I think Manual is right about the internal map with namespaces of
Read more >Mapping between Java language, WSDL and XML for JAX ...
ns, user-defined namespace. apache, http://xml.apache.org/xml-soap ... Not all Java classes and constructs have mappings to WSDL files.
Read more >JAXB Users Guide - Java EE
[ERROR] Property "MiOrMoOrMn" is already defined. line 132 of ... SYSTEM "http://www.w3.org/2001/xml.xsd" "xml.xsd" PUBLIC "-//W3C//DTD XMLSCHEMA ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
BTW this happens when the same schema is being compiled twice. For example, xsd:imports and schemas and episodes defined in the pom.xml. It’s very confusing. I spent quite a while figuring out how to do modular schema builds with the plugin that don’t produce errors like that. Work is documented in https://github.com/bubblegumproject/scrum4j-model
I got the same exception with these two XSD files:
It worked after I added a unique targetNamespace to each of the XSD files. This doesn’t appear to change the generated Java files in any way.
Update: adding namespaces to the XSD files will cause package-info.java with namespace information to be generated. I use the maven-clean-plugin to remove those files because in my case the generated XML must not use namespaces: