attr.setAnnotation(annotation);
}
NamedNodeMap attrNodes = attrEl.getAttributes();
Vector attrs = new Vector();
NodeNamespaceContext ctx = null;
for (int i = 0; i < attrNodes.getLength(); i++) {
Attr att = (Attr) attrNodes.item(i);
String attName = att.getName();
if (!attName.equals("name") &&
!attName.equals("type") &&
!attName.equals("default") &&
!attName.equals("fixed") &&
!attName.equals("form") &&
!attName.equals("id") &&
!attName.equals("use") &&
!attName.equals("ref")) {
attrs.add(att);
String value = att.getValue();
if (value.indexOf(":") > -1) {
// there is a possiblily of some namespace mapping
String prefix = value.substring(0, value.indexOf(":"));
if (ctx == null) {
ctx = new NodeNamespaceContext(attrEl);
}
String namespace = ctx.getNamespaceURI(prefix);
if (!Constants.NULL_NS_URI.equals(namespace)) {
Attr nsAttr = attrEl.getOwnerDocument().createAttribute("xmlns:" + prefix);
nsAttr.setValue(namespace);
attrs.add(nsAttr);
}