in apache-rat-tools/src/main/java/org/apache/rat/tools/xsd/XsdGenerator.java [135:167]
private void writeLicenses() throws IOException {
Description desc = DescriptionBuilder.buildMap(SimpleLicense.class);
List<Description> children = new ArrayList<>();
List<Description> attributes = new ArrayList<>();
if (desc != null && desc.getChildren() != null) {
for (Description child : desc.getChildren().values()) {
if (XMLConfig.isLicenseChild(child.getCommonName())) {
children.add(child);
} else {
if (child.getType() == ComponentType.PARAMETER) {
attributes.add(child);
}
}
}
}
writer.open(Type.ELEMENT, "name", XMLConfig.LICENSES, "maxOccurs", "1", "minOccurs", "0")
.open(Type.COMPLEX).open(Type.SEQUENCE)
.open(Type.ELEMENT, "name", XMLConfig.LICENSE, "maxOccurs", "unbounded", "minOccurs", "0")
.open(Type.COMPLEX).open(Type.CHOICE, "maxOccurs", "unbounded", "minOccurs", "1");
for (Description child : children) {
if (child.getCommonName().equals("matcher")) {
writer.open(Type.ELEMENT, "ref", XMLConfig.MATCHER, "maxOccurs", "1", "minOccurs", "1").close(Type.ELEMENT);
} else {
element(child);
}
}
writer.close(Type.CHOICE);
for (Description child : attributes) {
attribute(child);
}
writer.close(Type.ELEMENT).close(Type.ELEMENT);
}