writer.start("data", new String[] { "type", x.getName()});
// serialize effective facets
for (int i = effectiveFacets.size() - 1; i >= 0; i--) {
DataTypeWithFacet dtf = (DataTypeWithFacet)effectiveFacets.get(i);
if (dtf instanceof LengthFacet) {
param("length", Long.toString(((LengthFacet)dtf).length));
} else if (dtf instanceof MinLengthFacet) {
param("minLength", Long.toString(((MinLengthFacet)dtf).minLength));
} else if (dtf instanceof MaxLengthFacet) {
param("maxLength", Long.toString(((MaxLengthFacet)dtf).maxLength));
} else if (dtf instanceof PatternFacet) {
String pattern = "";
PatternFacet pf = (PatternFacet)dtf;
for (int j = 0; j < pf.getRegExps().length; j++) {
if (pattern.length() != 0)
pattern += "|";
pattern += pf.patterns[j];
}
param("pattern", pattern);
} else if (dtf instanceof TotalDigitsFacet) {
param("totalDigits", Long.toString(((TotalDigitsFacet)dtf).precision));
} else if (dtf instanceof FractionDigitsFacet) {
param("fractionDigits", Long.toString(((FractionDigitsFacet)dtf).scale));
} else if (dtf instanceof RangeFacet) {
param(dtf.facetName, dtf.convertToLexicalValue(((RangeFacet)dtf).limitValue, null));
// we don't need to pass SerializationContext because it is only
// for QName.
} else if (dtf instanceof WhiteSpaceFacet) {
; // do nothing.
} else