1 22 23 package org.xquark.schema.loader; 24 25 import org.xml.sax.Attributes ; 26 import org.xml.sax.SAXException ; 27 import org.xquark.schema.*; 28 import org.xquark.util.DefaultElementHandler; 29 import org.xquark.util.ElementHandler; 30 31 class AttributeTypeHandler extends DefaultElementHandler implements SchemaConstants 32 { 33 private static final String RCSRevision = "$Revision: 1.1 $"; 34 private static final String RCSName = "$Name: $"; 35 private Loader loader = null; 36 private AttributeDeclaration decl; 37 38 AttributeTypeHandler(Loader loader, AttributeDeclaration decl) { 39 this.loader = loader; 40 this.decl = decl; 41 } 42 43 public ElementHandler startElement(String namespaceURI, String localName, Attributes atts) 46 throws SAXException 47 { 48 if ( namespaceURI.equals(XMLSCHEMA_URI) ) { 49 if (localName.equals(SIMPLE_TYPE_TAG)) { 50 if ( decl instanceof AttributeDeclarationRef ) { 51 String errCode = "src-attribute.3.2"; 52 String errMsg = "Error while processing localName -> " + localName; 53 loader.reportLoadingError(errMsg, new SchemaException(errCode)); 54 } 55 if (decl.getType() != null) { 56 String errCode = "src-attribute.4"; 57 String errMsg = "Error while processing localName -> " + localName; 58 loader.reportLoadingError(errMsg, new SchemaException(errCode)); 59 } 60 SimpleType type = null; 61 try { 62 type = loader.buildSimpleType(atts); 63 } 64 catch ( SchemaException se ) { 65 String errMsg = "Error while processing localName -> " + localName; 66 loader.reportLoadingError(errMsg, se); 67 } 68 decl.setType(type); 69 return new SimpleTypeHandler(loader, type, false, false); 70 } 71 72 else if (localName.equals(ANNOTATION_TAG)) { 73 return new AnnotationHandler(); 74 } 75 } 76 loader.notifyUnknownElement(namespaceURI, localName); 77 return this; 78 } 79 } 80 81 | Popular Tags |