@Override public void writeSchema(XmlSchema root) { XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root, true); simple.setName(getSchemaType().getLocalPart()); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); simple.setContent(restriction); Object[] constants = getTypeClass().getEnumConstants(); List<XmlSchemaFacet> facets = restriction.getFacets(); for (Object constant : constants) { XmlSchemaEnumerationFacet f = new XmlSchemaEnumerationFacet(); f.setValue(getValue(constant)); facets.add(f); } }
@Override public void writeSchema(XmlSchema root) { XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root, true); simple.setName(getSchemaType().getLocalPart()); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); simple.setContent(restriction); Object[] constants = getTypeClass().getEnumConstants(); List<XmlSchemaFacet> facets = restriction.getFacets(); for (Object constant : constants) { XmlSchemaEnumerationFacet f = new XmlSchemaEnumerationFacet(); f.setValue(getValue(constant)); facets.add(f); } }
simpleType.setName(enumClass); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); List enumList = Arrays.asList(classType.getEnumConstants()); for(Object enumObj : enumList){ // add all enum constants to restriction facet
simpleType.setName(enumClass); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); List enumList = Arrays.asList(classType.getEnumConstants()); for(Object enumObj : enumList){ // add all enum constants to restriction facet
@Nonnull protected XmlSchemaType createNumberSchemaType(NumberResolvedType numberTypeDefinition, QName baseType) { final XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, false); final XmlSchemaSimpleTypeRestriction content = new XmlSchemaSimpleTypeRestriction(); content.setBaseTypeName(baseType); if (numberTypeDefinition.getMinimum() != null) { final XmlSchemaMinInclusiveFacet minLength = new XmlSchemaMinInclusiveFacet(); minLength.setValue(numberTypeDefinition.getMinimum()); content.getFacets().add(minLength); } if (numberTypeDefinition.getMaximum() != null) { final XmlSchemaMaxInclusiveFacet maxLength = new XmlSchemaMaxInclusiveFacet(); maxLength.setValue(numberTypeDefinition.getMaximum()); content.getFacets().add(maxLength); } simpleType.setContent(content); return simpleType; }
@Nonnull protected XmlSchemaType createNumberSchemaType(NumberResolvedType numberTypeDefinition, QName baseType) { final XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, false); final XmlSchemaSimpleTypeRestriction content = new XmlSchemaSimpleTypeRestriction(); content.setBaseTypeName(baseType); if (numberTypeDefinition.getMinimum() != null) { final XmlSchemaMinInclusiveFacet minLength = new XmlSchemaMinInclusiveFacet(); minLength.setValue(numberTypeDefinition.getMinimum()); content.getFacets().add(minLength); } if (numberTypeDefinition.getMaximum() != null) { final XmlSchemaMaxInclusiveFacet maxLength = new XmlSchemaMaxInclusiveFacet(); maxLength.setValue(numberTypeDefinition.getMaximum()); content.getFacets().add(maxLength); } simpleType.setContent(content); return simpleType; }
simpleType.setName(stringScopedName.toString()); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet(); maxLengthFacet.setValue(boundNode.toString());
content.setBaseTypeName(Constants.XSD_STRING); if (stringTypeDefinition.getMinLength() != null)
content.setBaseTypeName(Constants.XSD_STRING); if (stringTypeDefinition.getMinLength() != null)
simpleType.setName(stringScopedName.toString()); XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction(); restriction.setBaseTypeName(Constants.XSD_STRING); XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet(); maxLengthFacet.setValue(boundNode.toString());
fixedRestriction.setBaseTypeName(Constants.XSD_DECIMAL); XmlSchemaTotalDigitsFacet fixedTotalDigits = new XmlSchemaTotalDigitsFacet(); fixedTotalDigits.setValue(digitsNode.toString());
enumSchemaSimpleTypeRestriction.setBaseTypeName(Constants.XSD_STRING);