Open nemonik opened 9 years ago
If you clone https://github.com/nemonik/java_stix.git and comment the call to the patch near abouts line 104, and then run the gradle script XJC will fail to build the simple DOM be cause of properties "EncryptionAlgorithm" and "DecryptionKey" already being defined.
:generateJAXB
[ant:xjc] [ERROR] Property "EncryptionAlgorithm" is already defined. Use <jaxb:property> to resolve this conflict.
[ant:xjc] line 42 of file:/Users/walsh/Development/workspace/fresh_java_stix/src/main/resources/schemas/cybox/objects/Archive_File_Object.xsd
[ant:xjc]
[ant:xjc] [ERROR] The following location is relevant to the above error
[ant:xjc] line 131 of file:/Users/walsh/Development/workspace/fresh_java_stix/src/main/resources/schemas/cybox/objects/File_Object.xsd
[ant:xjc]
[ant:xjc] [ERROR] Property "DecryptionKey" is already defined. Use <jaxb:property> to resolve this conflict.
[ant:xjc] line 47 of file:/Users/walsh/Development/workspace/fresh_java_stix/src/main/resources/schemas/cybox/objects/Archive_File_Object.xsd
[ant:xjc]
[ant:xjc] [ERROR] The following location is relevant to the above error
[ant:xjc] line 136 of file:/Users/walsh/Development/workspace/fresh_java_stix/src/main/resources/schemas/cybox/objects/File_Object.xsd
[ant:xjc]
:generateJAXB FAILED
Where are we with this?
If it would help, I could commit this in a branch. It won't be in the "official" schemas until the next release, and even then, I'm not sure we can do it in a minor release or if it would have to be in a major release. Because the elements are defined by an xs:sequence
and are in different namespaces, it's possible this change could break existing content.
Updated title slightly for accuracy.
I don't think this is really an issue of duplicate elements, just duplicate element names (even though they really reside in different namespaces). On the File Object, "Encryption_Algorithm"/"Decryption_Key" refer to the encryption of an individual file. On the Archive File Object, they refer to the encryption of the archive file itself. Thus, they serve different use cases (you might have an Archive File that's encrypted one way, and which contains one or more Files that are encrypted in a different way). My suggestion would be to simply rename "Encryption_Algorithm" and "Decryption_Key" on the Archive File Object to "Archive_Encryption_Algorithm" and "Archive_Decryption_Key", respectively.
Both "Encryption_Algorithm" and "Decryption_Key" appear in the Archive_File_Object.xsd when they already are declared in the File_Object.xsd schema. This causes problems.
See patch below.