@Override public void endElement(String uri, String localName, String qName) throws SAXException { curElem = false; curValue = curValue.trim(); // check for a known tag if (qName.equals("name")) { curMission.setName(curValue); } else if (qName.equals("players")) { curMission.setPlayers(curValue); } else if (qName.equals("time-limit")) { curMission.setTime(curValue, true); } else if (qName.equals("time")) { curMission.setTime(curValue, false); } else if (qName.equals("info")) { curMission.setInfo(curValue); } else if (qName.equals("mission")) { // Log.v(tag, "Adding mission " + curName + " (" + curMission.getName() + ")"); data.put(curName, curMission); curName = ""; curMission = null; } else if (qName.equals("details")) { mLoaded = true; } curValue = ""; }
/** * Class initializer: Populate a table to translate SAX attribute type names into JDOM attribute * type value (integer). * * <p><b>Note that all the mappings defined below are compliant with the SAX 2.0 specification * exception for "ENUMERATION" with is specific to Crimson 1.1.X and Xerces 2.0.0-betaX which * report attributes of enumerated types with a type "ENUMERATION" instead of the expected * "NMTOKEN". * * <p>Note also that Xerces 1.4.X is not SAX 2.0 compliant either but handling its case requires * {@link #getAttributeType specific code}. */ static { attrNameToTypeMap.put("CDATA", new Integer(Attribute.CDATA_TYPE)); attrNameToTypeMap.put("ID", new Integer(Attribute.ID_TYPE)); attrNameToTypeMap.put("IDREF", new Integer(Attribute.IDREF_TYPE)); attrNameToTypeMap.put("IDREFS", new Integer(Attribute.IDREFS_TYPE)); attrNameToTypeMap.put("ENTITY", new Integer(Attribute.ENTITY_TYPE)); attrNameToTypeMap.put("ENTITIES", new Integer(Attribute.ENTITIES_TYPE)); attrNameToTypeMap.put("NMTOKEN", new Integer(Attribute.NMTOKEN_TYPE)); attrNameToTypeMap.put("NMTOKENS", new Integer(Attribute.NMTOKENS_TYPE)); attrNameToTypeMap.put("NOTATION", new Integer(Attribute.NOTATION_TYPE)); attrNameToTypeMap.put("ENUMERATION", new Integer(Attribute.ENUMERATED_TYPE)); }
/** * This is called when the parser encounters an external entity declaration. * * @param name entity name * @param publicID public id * @param systemID system id * @throws SAXException when things go wrong */ public void externalEntityDecl(String name, String publicID, String systemID) throws SAXException { // Store the public and system ids for the name externalEntities.put(name, new String[] {publicID, systemID}); if (!inInternalSubset) return; internalSubset.append(" <!ENTITY ").append(name); appendExternalId(publicID, systemID); internalSubset.append(">\n"); }