protected void processSimpleTypeDefinition(XSDSimpleTypeDefinition type, Node node) throws RepositoryException { boolean isAnonymous = type.getName() == null; String nodeName = isAnonymous ? XsdLexicon.SIMPLE_TYPE : type.getName(); // This is a normal simple type definition ... logger.debug("Simple type: '{0}' in ns '{1}' ", type.getName(), type.getTargetNamespace()); Node typeNode = node.addNode(nodeName, XsdLexicon.SIMPLE_TYPE_DEFINITION); typeNode.setProperty(XsdLexicon.NAMESPACE, type.getTargetNamespace()); if (!isAnonymous) { typeNode.setProperty(XsdLexicon.NC_NAME, type.getName()); registerForSymbolSpace( TYPE_DEFINITIONS, type.getTargetNamespace(), type.getName(), typeNode.getIdentifier()); } processTypeFacets(type, typeNode, type.getBaseType()); processNonSchemaAttributes(type, typeNode); }
protected void processTypeFacets( XSDSimpleTypeDefinition type, Node typeNode, XSDTypeDefinition baseType) throws RepositoryException { if (baseType == null) { baseType = type.getBaseType(); } if (baseType == type) { // The base type is the anytype ... baseType = type.getSchema() .getSchemaForSchema() .resolveSimpleTypeDefinition("http://www.w3.org/2001/XMLSchema", "anyType"); } if (baseType != null) { typeNode.setProperty(XsdLexicon.BASE_TYPE_NAME, baseType.getName()); typeNode.setProperty(XsdLexicon.BASE_TYPE_NAMESPACE, baseType.getTargetNamespace()); setReference( typeNode, XsdLexicon.BASE_TYPE_REFERENCE, TYPE_DEFINITIONS, baseType.getTargetNamespace(), baseType.getName()); } processFacet( type.getEffectiveMaxLengthFacet(), typeNode, XsdLexicon.MAX_LENGTH, PropertyType.LONG); processFacet(type.getMaxLengthFacet(), typeNode, XsdLexicon.MAX_LENGTH, PropertyType.LONG); processFacet( type.getEffectiveMinLengthFacet(), typeNode, XsdLexicon.MIN_LENGTH, PropertyType.LONG); processFacet(type.getMinLengthFacet(), typeNode, XsdLexicon.MIN_LENGTH, PropertyType.LONG); processFacet( type.getEffectiveMaxFacet(), typeNode, XsdLexicon.MAX_VALUE_EXCLUSIVE, PropertyType.LONG); processFacet( type.getMaxExclusiveFacet(), typeNode, XsdLexicon.MAX_VALUE_EXCLUSIVE, PropertyType.LONG); processFacet( type.getEffectiveMinFacet(), typeNode, XsdLexicon.MIN_VALUE_EXCLUSIVE, PropertyType.LONG); processFacet( type.getMinExclusiveFacet(), typeNode, XsdLexicon.MIN_VALUE_EXCLUSIVE, PropertyType.LONG); processFacet( type.getMaxInclusiveFacet(), typeNode, XsdLexicon.MAX_VALUE_INCLUSIVE, PropertyType.LONG); processFacet( type.getMinInclusiveFacet(), typeNode, XsdLexicon.MIN_VALUE_INCLUSIVE, PropertyType.LONG); processFacet( type.getEffectiveTotalDigitsFacet(), typeNode, XsdLexicon.TOTAL_DIGITS, PropertyType.LONG); processFacet(type.getTotalDigitsFacet(), typeNode, XsdLexicon.TOTAL_DIGITS, PropertyType.LONG); processFacet( type.getEffectiveFractionDigitsFacet(), typeNode, XsdLexicon.FRACTION_DIGITS, PropertyType.LONG); processFacet( type.getFractionDigitsFacet(), typeNode, XsdLexicon.FRACTION_DIGITS, PropertyType.LONG); processFacet( type.getEffectiveWhiteSpaceFacet(), typeNode, XsdLexicon.WHITESPACE, PropertyType.STRING); processFacet(type.getWhiteSpaceFacet(), typeNode, XsdLexicon.WHITESPACE, PropertyType.STRING); processFacet( type.getEffectivePatternFacet(), typeNode, XsdLexicon.PATTERN, PropertyType.STRING); @SuppressWarnings("unchecked") List<XSDPatternFacet> patternFacets = type.getPatternFacets(); processFacetsList(patternFacets, typeNode, XsdLexicon.PATTERN); processFacet( type.getEffectiveEnumerationFacet(), typeNode, XsdLexicon.ENUMERATED_VALUES, PropertyType.STRING); @SuppressWarnings("unchecked") List<XSDEnumerationFacet> enumFacets = type.getEnumerationFacets(); processFacetsList(enumFacets, typeNode, XsdLexicon.ENUMERATED_VALUES); @SuppressWarnings("unchecked") List<XSDSimpleFinal> finalFacets2 = type.getFinal(); processEnumerators(finalFacets2, typeNode, XsdLexicon.FINAL); processAnnotation(type.getAnnotation(), typeNode); }