/** * tds radar dataset collection factory * * @param desc _more_ * @param dsc_location _more_ * @param errlog _more_ * @return dataset collection * @throws IOException _more_ */ public static IdvRadarDatasetCollection factory( String desc, String dsc_location, StringBuffer errlog) throws IOException { // super(); SAXBuilder builder; Document doc = null; XMLEntityResolver jaxp = new XMLEntityResolver(true); builder = jaxp.getSAXBuilder(); try { doc = builder.build(dsc_location); } catch (JDOMException e) { errlog.append(e.toString()); } Element qcElem = doc.getRootElement(); Namespace ns = qcElem.getNamespace(); return new IdvRadarDatasetCollection(desc, dsc_location, qcElem, ns, errlog); }
/** * retrieve all radar stations in this dataset collection * * @param stsXML_location _more_ * @return station hashmap * @throws IOException _more_ */ public HashMap readRadarStations(String stsXML_location) throws IOException { SAXBuilder builder; Document doc = null; XMLEntityResolver jaxp = new XMLEntityResolver(true); builder = jaxp.getSAXBuilder(); HashMap stations = new HashMap(); try { doc = builder.build(stsXML_location); } catch (JDOMException e) { e.printStackTrace(); } Element rootElem = doc.getRootElement(); List<Element> children = rootElem.getChildren(); for (Element child : children) { Station s; if (null != (s = readStation(child))) { stations.put(s.getName(), s); } } return stations; }