String conf = attributes.getValue("name");
String conf = _ivy.substitute(attributes.getValue("name"));
    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {        try {            if ("ivy-module".equals(qName)) {                String version = attributes.getValue("version");                int versionIndex = ALLOWED_VERSIONS.indexOf(version);                if (versionIndex == -1) {                    addError("invalid version "+version);                    throw new SAXException("invalid version "+version);                }                if (versionIndex >= ALLOWED_VERSIONS.indexOf("1.3")) {                    Message.debug("post 1.3 ivy file: using "+PatternMatcher.EXACT+" as default matcher");                    _defaultMatcher = _ivy.getMatcher(PatternMatcher.EXACT);                } else {                    Message.debug("pre 1.3 ivy file: using "+PatternMatcher.EXACT_OR_REGEXP+" as default matcher");                    _defaultMatcher = _ivy.getMatcher(PatternMatcher.EXACT_OR_REGEXP);                }            } else if ("info".equals(qName)) {                _state = INFO;                String org = _ivy.substitute(attributes.getValue("organisation"));                String module = _ivy.substitute(attributes.getValue("module"));                String revision = _ivy.substitute(attributes.getValue("revision"));                _md.setModuleRevisionId(ModuleRevisionId.newInstance(org, module, revision));                String namespace = _ivy.substitute(attributes.getValue("namespace"));                if (namespace != null) {                    Namespace ns = _ivy.getNamespace(namespace);                    if (ns == null) {                        Message.warn("namespace not found for "+_md.getModuleRevisionId()+": "+namespace);                    } else {                        _md.setNamespace(ns);                    }                }                                String status = _ivy.substitute(attributes.getValue("status"));                _md.setStatus(status == null ? Status.DEFAULT_STATUS : status);                _md.setDefault(Boolean.valueOf(_ivy.substitute(attributes.getValue("default"))).booleanValue());                String pubDate = _ivy.substitute(attributes.getValue("publication"));                if (pubDate != null && pubDate.length() > 0) {                    try {                        _md.setPublicationDate(Ivy.DATE_FORMAT.parse(pubDate));                    } catch (ParseException e) {                        addError("invalid publication date format: "+pubDate);                        _md.setPublicationDate(getDefaultPubDate());                    }                } else {                    _md.setPublicationDate(getDefaultPubDate());                                    }            } else if ("license".equals(qName)) {                _md.addLicense(new License(attributes.getValue("name"), attributes.getValue("url")));            } else if ("description".equals(qName)) {                _md.setHomePage(attributes.getValue("homepage"));            } else if ("configurations".equals(qName)) {                _state = CONF;                setDefaultConfMapping(_ivy.substitute(attributes.getValue("defaultconfmapping")));            } else if ("publications".equals(qName)) {                _state = PUB;                _artifactsDeclared = true;                checkConfigurations();            } else if ("dependencies".equals(qName)) {                _state = DEP;                String defaultConf = _ivy.substitute(attributes.getValue("defaultconf"));                if (defaultConf != null) {                    setDefaultConf(defaultConf);                }                defaultConf = _ivy.substitute(attributes.getValue("defaultconfmapping"));                if (defaultConf != null) {                    setDefaultConfMapping(defaultConf);                }                checkConfigurations();            } else if ("conflicts".equals(qName)) {                _state = CONFLICT;                checkConfigurations();            } else if ("artifact".equals(qName)) {                if (_state == PUB) {                    // this is a published artifact                    String ext = attributes.getValue("ext");                    ext = ext != null?ext:attributes.getValue("type");                    _artifact = new MDArtifact(_md, attributes.getValue("name"), attributes.getValue("type"), ext);                    String confs = attributes.getValue("conf");                    // only add confs if they are specified. if they aren't, endElement will handle this                    // only if there are no conf defined in sub elements                    if (confs != null && confs.length() > 0) {                        String[] conf;                        if ("*".equals(confs)) {                            conf = _md.getConfigurationsNames();                        } else {                            conf = confs.split(",");                        }                        for (int i = 0; i < conf.length; i++) {                            _artifact.addConfiguration(conf[i].trim());                            _md.addArtifact(conf[i].trim(), _artifact);                        }                    }                } else if (_state == DEP) {                    // this is an artifact asked for a particular dependency                    addDependencyArtifactsIncludes(attributes);                } else if (_validate) {                    addError("artifact tag found in invalid tag: "+_state);                }            } else if ("include".equals(qName) && _state == DEP) {                addDependencyArtifactsIncludes(attributes);            } else if ("exclude".equals(qName)) {                addDependencyArtifactsExcludes(attributes);            } else if ("dependency".equals(qName)) {                String org = _ivy.substitute(attributes.getValue("org"));                if (org == null) {                     org = _md.getModuleRevisionId().getOrganisation();                }                boolean force = Boolean.valueOf(attributes.getValue("force")).booleanValue();                boolean changing = Boolean.valueOf(attributes.getValue("changing")).booleanValue();                String transitiveValue = attributes.getValue("transitive");                boolean transitive = (transitiveValue == null) ? true : Boolean.valueOf(attributes.getValue("transitive")).booleanValue();                                String name = _ivy.substitute(attributes.getValue("name"));                String rev = _ivy.substitute(attributes.getValue("rev"));                _dd = new DefaultDependencyDescriptor(_md, ModuleRevisionId.newInstance(org, name, rev), force, changing, transitive);                _md.addDependency(_dd);                String confs = attributes.getValue("conf");                if (confs != null && confs.length() > 0) {                    parseDepsConfs(confs, _dd);                }            } else if ("conf".equals(qName)) {        	    String conf = attributes.getValue("name");                switch (_state) {            	case CONF:                    String visibility = attributes.getValue("visibility");                    String ext = attributes.getValue("extends");                	_md.addConfiguration(new Configuration(                            conf,                             Configuration.Visibility.getVisibility(visibility == null ? "public":visibility),                            attributes.getValue("description"),                            ext==null?null:ext.split(",")));                	break;            	case PUB:            	    if ("*".equals(conf)) {            	        String[] confs = _md.getConfigurationsNames();            	        for (int i = 0; i < confs.length; i++) {        	                _artifact.addConfiguration(confs[i]);        	                _md.addArtifact(confs[i], _artifact);                        }            	    } else {    	                _artifact.addConfiguration(conf);    	                _md.addArtifact(conf, _artifact);            	    }                	break;                case DEP:                    _conf = conf;                    String mappeds = attributes.getValue("mapped");                    if (mappeds != null) {                        String[] mapped = mappeds.split(",");                        for (int i = 0; i < mapped.length; i++) {                            _dd.addDependencyConfiguration(_conf, mapped[i].trim());                        }                    }                    break;                case ARTIFACT_INCLUDE:                case ARTIFACT_EXCLUDE:                    _dad.addConfiguration(conf);                    break;                default:                    if (_validate) {                        addError("conf tag found in invalid tag: "+_state);                    }                	break;                }            } else if ("mapped".equals(qName)) {                _dd.addDependencyConfiguration(_conf, attributes.getValue("name"));            } else if ("manager".equals(qName) && _state == CONFLICT) {                String org = _ivy.substitute(attributes.getValue("org"));                org = org == null ? PatternMatcher.ANY_EXPRESSION : org;                String mod = _ivy.substitute(attributes.getValue("module"));                mod = mod == null ? PatternMatcher.ANY_EXPRESSION : mod;                ConflictManager cm;                String name = _ivy.substitute(attributes.getValue("name"));                String rev = _ivy.substitute(attributes.getValue("rev"));                if (rev != null) {                    String[] revs = rev.split(",");                    for (int i = 0; i < revs.length; i++) {                        revs[i] = revs[i].trim();                    }                    cm = new FixedConflictManager(revs);                } else if (name != null) {                    cm = _ivy.getConflictManager(name);                    if (cm == null) {                        addError("unknown conflict manager: "+name);                        return;                    }                } else {                    addError("bad conflict manager: no name nor rev");                    return;                }                String matcherName = attributes.getValue("matcher");                PatternMatcher matcher = matcherName == null ? _defaultMatcher : _ivy.getMatcher(matcherName);                if (matcher == null) {                    addError("unknown matcher: "+matcherName);                    return;                }                _md.addConflictManager(new ModuleId(org, mod), matcher, cm);            } else if ("import".equals(qName) || ("include".equals(qName) && _state == CONF)) {                URL url;                String fileName = _ivy.substitute(attributes.getValue("file"));                if (fileName == null) {                    String urlStr = _ivy.substitute(attributes.getValue("url"));                    url = new URL(urlStr);                } else {                    url = new File(fileName).toURL();                }                                                // create a new temporary parser to read the configurations from                // the specified file.                Parser parser = new Parser(_ivy, false);                parser._md = new DefaultModuleDescriptor();                XMLHelper.parse(url, null, parser);                                // add the configurations from this temporary parser to this module descriptor                Configuration[] configs = parser.getModuleDescriptor().getConfigurations();                for (int i = 0; i < configs.length; i++) {                    _md.addConfiguration(configs[i]);                }                if (parser.getDefaultConfMapping() != null) {                    Message.debug("setting default conf from imported configurations file: "+parser.getDefaultConfMapping());                    setDefaultConfMapping(parser.getDefaultConfMapping());                }            } else if (_validate && _state != INFO) {                addError("unknwon tag "+qName);            }        } catch (Exception ex) {            if (ex instanceof SAXException) {                throw (SAXException)ex;            }            throw new SAXException("problem occured while parsing ivy file. message: "+ex.getMessage(), ex);        }    }