XSFacet facet = getFacet(simpleType, XSSimpleTypeDefinition.FACET_MININCLUSIVE); if (facet != null) { minInclusive = facet.getLexicalFacetValue(); facet = getFacet(simpleType, XSSimpleTypeDefinition.FACET_MINEXCLUSIVE); if (facet != null) { minExclusive = facet.getLexicalFacetValue(); facet = getFacet(simpleType, XSSimpleTypeDefinition.FACET_MAXINCLUSIVE); if (facet != null) { maxInclusive = facet.getLexicalFacetValue(); facet = getFacet(simpleType, XSSimpleTypeDefinition.FACET_MAXEXCLUSIVE); if (facet != null) { maxExclusive = facet.getLexicalFacetValue(); facet = getFacet(simpleType, XSSimpleTypeDefinition.FACET_TOTALDIGITS); if (facet != null) { totalDigits = Integer.parseInt(facet.getLexicalFacetValue()); facet = getFacet(simpleType, XSSimpleTypeDefinition.FACET_FRACTIONDIGITS); if (facet != null) { fractionDigits = Integer.parseInt(facet.getLexicalFacetValue());
private static boolean checkBooleanType(XSTypeDefinition td) { if (td.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) { return false; } final XSSimpleTypeDefinition st = ((XSSimpleTypeDefinition) td); final XSObjectList facets = st.getFacets(); for (int i = 0; i < facets.getLength(); i++) { final XSFacet facet = (XSFacet) facets.item(i); if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_LENGTH) { if ("0".equals(facet.getLexicalFacetValue())) { return true; } } } return false; }
XSFacet facet = getFacet(itemType, XSSimpleTypeDefinition.FACET_LENGTH); if (facet != null) { len = Integer.parseInt(facet.getLexicalFacetValue()); } else { int minOccurs = 0; facet = getFacet(itemType, XSSimpleTypeDefinition.FACET_MINLENGTH); if (facet != null) { minOccurs = Integer.parseInt(facet.getLexicalFacetValue()); maxOccurs = Integer.parseInt(facet.getLexicalFacetValue()); int len = Integer.parseInt(facet.getLexicalFacetValue()); len -= hint.length(); len -= countStr.length(); int maxLen = Integer.parseInt(facet.getLexicalFacetValue()); int len = maxLen; len = hint.length() + countStr.length() - len;
private void export( XMLStreamWriter writer, SimplePropertyType pt ) throws XMLStreamException { XSSimpleTypeDefinition xsdType = pt.getPrimitiveType().getXSType(); if ( xsdType == null ) { // export without XML schema information BaseType type = pt.getPrimitiveType().getBaseType(); writer.writeAttribute( "type", getSimpleType( type ) ); } else { // reconstruct XML schema type definition String name = xsdType.getName(); String ns = xsdType.getNamespace(); if ( xsdType.getName() != null ) { QName qName = new QName( ns, name ); writer.writeAttribute( "type", getPrefixedName( qName ) ); } else { // unnamed simple property writer.writeStartElement( "simpleType" ); writer.writeStartElement( "restriction" ); writer.writeAttribute( "base", getSimpleType( pt.getPrimitiveType().getBaseType() ) ); XSObjectList facets = pt.getPrimitiveType().getXSType().getFacets(); for ( int i = 0; i < facets.getLength(); i++ ) { XSFacet facet = (XSFacet) facets.item( i ); writer.writeEmptyElement( getFacetName( facet.getFacetKind() ) ); writer.writeAttribute( "value", facet.getLexicalFacetValue() ); } writer.writeEndElement(); writer.writeEndElement(); } } }