/** * Returns the ElementDecl of associated with the given name * * @return the ElementDecl of associated with the given name, or null if no ElementDecl with the * given name was found. */ public ElementDecl getElementDecl(String name) { String ns = null; if (name == null) { String err = NULL_ARGUMENT + "getElementDecl: "; err += " 'name' can not be null"; throw new IllegalArgumentException(err); } int idx = name.indexOf(':'); if (idx >= 0) { String nsPrefix = name.substring(0, idx); name = name.substring(idx + 1); ns = (String) namespaces.get(nsPrefix); if (ns == null) { String err = "getElementDecl: "; err += "Namespace prefix not recognized '" + nsPrefix + "'"; throw new IllegalArgumentException(err); } } if ((ns == null) || (ns.equals(targetNS))) return (ElementDecl) elements.get(name); else { Schema schema = getImportedSchema(ns); if (schema != null) { String warning = "Warning : do not forget to generate the source "; warning += "for the schema with this targetNamespace" + schema.getTargetNamespace(); System.out.println(warning); return schema.getElementDecl(name); } } return null; } // --getElementDecl
/** * Returns the ElementDecl of associated with the given name * @return the ElementDecl of associated with the given name, or * null if no ElementDecl with the given name was found. **/ public ElementDecl getElementDecl(String name) { String ns = null; if (name == null) { String err = NULL_ARGUMENT + "getElementDecl: "; err += " 'name' can not be null"; throw new IllegalArgumentException(err); } int idx = name.indexOf(':'); if (idx >= 0) { String nsPrefix = name.substring(0,idx); name = name.substring(idx + 1); ns = (String) _namespaces.getNamespaceURI(nsPrefix); if (ns == null) { String err = "getElementDecl: "; err += "Namespace prefix not recognized '"+nsPrefix+"'"; throw new IllegalArgumentException(err); } } if ((ns==null) || (ns.equals(_targetNamespace)) ) return (ElementDecl)_elements.get(name); else { Schema schema = getImportedSchema(ns); if (schema!=null) { return schema.getElementDecl(name); } } return null; } //--getElementDecl