for (int i = 0; i < nl.getLength(); i++) {
// one element now
elem = (Element) nl.item(i);
AttributeTypeInfoDTO ati = new AttributeTypeInfoDTO();
String name = ReaderUtils.getAttribute(elem, "name", false);
String ref = ReaderUtils.getAttribute(elem, "ref", false);
String type = ReaderUtils.getAttribute(elem, "type", false);
NameSpaceTranslator nst1 = NameSpaceTranslatorFactory.getInstance()
.getNameSpaceTranslator("xs");
NameSpaceTranslator nst2 = NameSpaceTranslatorFactory.getInstance()
.getNameSpaceTranslator("gml");
if ((ref != null) && (ref != "")) {
ati.setComplex(false);
nse = nst1.getElement(ref);
if (nse == null) {
nse = nst2.getElement(ref);
}
String tmp = nse.getTypeRefName();
//tmp = Character.toLowerCase(tmp.charAt(0)) + tmp.substring(1);
ati.setType(tmp);
ati.setName(tmp);
} else {
ati.setName(name);
if ((type != null) && (type != "")) {
nse = nst1.getElement(type);
if (nse == null) {
nse = nst2.getElement(type);
}
String tmp = nse.getTypeRefName();
ati.setType(tmp);
ati.setComplex(false);
} else {
Element tmp = ReaderUtils.getFirstChildElement(elem);
OutputFormat format = new OutputFormat(tmp.getOwnerDocument());
format.setLineSeparator(LineSeparator.Windows);
format.setIndenting(true);
format.setLineWidth(0);
format.setPreserveSpace(true);
StringWriter sw = new StringWriter();
XMLSerializer serializer = new XMLSerializer(sw, format);
try {
serializer.asDOMSerializer();
serializer.serialize(tmp);
} catch (IOException e) {
throw new ConfigurationException(e);
}
ati.setType(elem.toString());
ati.setComplex(true);
}
}
ati.setNillable(ReaderUtils.getBooleanAttribute(elem, "nillable",
false, true));
ati.setMaxOccurs(ReaderUtils.getIntAttribute(elem, "maxOccurs",
false, 1));
ati.setMinOccurs(ReaderUtils.getIntAttribute(elem, "minOccurs",
false, 1));
list.add(ati);
}
featureTypeInfoDTO.setSchemaAttributes(list);