protected double readDouble(Element elem) { if (elem == null) return Double.NaN; String text = elem.getText(); try { return Double.parseDouble(text); } catch (NumberFormatException e) { factory.appendErr(" ** Parse error: Bad double format = " + text + "\n"); return Double.NaN; } }
protected double readDouble(Element elem) { if (elem == null) return Double.NaN; String text = elem.getText(); try { return Double.parseDouble( text); } catch (NumberFormatException e) { factory.appendErr(" ** Parse error: Bad double format = "+text+"\n"); return Double.NaN; } }
protected double readDouble(Element elem) { if (elem == null) return Double.NaN; String text = elem.getText(); try { return Double.parseDouble(text); } catch (NumberFormatException e) { factory.appendErr(" ** Parse error: Bad double format = " + text + "\n"); return Double.NaN; } }
protected DateType makeDateType(String text, String format, String type) { if (text == null) return null; try { return new DateType(text, format, type); } catch (java.text.ParseException e) { factory.appendErr(" ** Parse error: Bad date format = " + text + "\n"); return null; } }
protected DateType makeDateType(String text, String format, String type) { if (text == null) return null; try { return new DateType( text, format, type); } catch (java.text.ParseException e) { factory.appendErr(" ** Parse error: Bad date format = "+text+"\n"); return null; } }
protected DateType makeDateType(String text, String format, String type) { if (text == null) return null; try { return new DateType(text, format, type); } catch (java.text.ParseException e) { factory.appendErr(" ** Parse error: Bad date format = " + text + "\n"); return null; } }
protected TimeDuration readDuration(Element elem) { if (elem == null) return null; String text = null; try { text = elem.getText(); return new TimeDuration(text); } catch (java.text.ParseException e) { factory.appendErr(" ** Parse error: Bad duration format = " + text + "\n"); return null; } }
protected TimeDuration readDuration(Element elem) { if (elem == null) return null; String text = null; try { text = elem.getText(); return new TimeDuration( text); } catch (java.text.ParseException e) { factory.appendErr(" ** Parse error: Bad duration format = "+text+"\n"); return null; } }
protected TimeDuration readDuration(Element elem) { if (elem == null) return null; String text = null; try { text = elem.getText(); return new TimeDuration(text); } catch (java.text.ParseException e) { factory.appendErr(" ** Parse error: Bad duration format = " + text + "\n"); return null; } }
protected double readDataSize(Element parent) { Element elem = parent.getChild("dataSize", defNS); if (elem == null) return Double.NaN; double size; String sizeS = elem.getText(); try { size = Double.parseDouble( sizeS); } catch (NumberFormatException e) { factory.appendErr(" ** Parse error: Bad double format in size element = "+sizeS+"\n"); return Double.NaN; } String units = elem.getAttributeValue("units"); char c = Character.toUpperCase(units.charAt(0)); if (c == 'K') size *= 1000; else if (c == 'M') size *= 1000 * 1000; else if (c == 'G') size *= 1000 * 1000 * 1000; else if (c == 'T') size *= 1000.0 * 1000 * 1000 * 1000; else if (c == 'P') size *= 1000.0 * 1000 * 1000 * 1000 * 1000; return size; }
protected double readDataSize(Element parent) { Element elem = parent.getChild("dataSize", defNS); if (elem == null) return Double.NaN; double size; String sizeS = elem.getText(); try { size = Double.parseDouble(sizeS); } catch (NumberFormatException e) { factory.appendErr(" ** Parse error: Bad double format in size element = " + sizeS + "\n"); return Double.NaN; } String units = elem.getAttributeValue("units"); char c = Character.toUpperCase(units.charAt(0)); if (c == 'K') size *= 1000; else if (c == 'M') size *= 1000 * 1000; else if (c == 'G') size *= 1000 * 1000 * 1000; else if (c == 'T') size *= 1000.0 * 1000 * 1000 * 1000; else if (c == 'P') size *= 1000.0 * 1000 * 1000 * 1000 * 1000; return size; }
protected InvDocumentation readDocumentation(InvCatalog cat, Element s) { String href = s.getAttributeValue("href", xlinkNS); String title = s.getAttributeValue("title", xlinkNS); String type = s.getAttributeValue("type"); // not XLink type String content = s.getTextNormalize(); URI uri = null; if (href != null) { try { uri = cat.resolveUri(href); } catch (Exception e) { factory.appendErr(" ** Invalid documentation href = " + href + " " + e.getMessage() + "\n"); } } InvDocumentation doc = new InvDocumentation(href, uri, title, type, content); // LOOK XHTML ?? !! if (InvCatalogFactory.debugXML) System.out.println(" Documentation added: " + doc); return doc; }
protected InvDocumentation readDocumentation(InvCatalog cat, Element s) { String href = s.getAttributeValue("href", xlinkNS); String title = s.getAttributeValue("title", xlinkNS); String type = s.getAttributeValue("type"); // not XLink type String content = s.getTextNormalize(); URI uri = null; if (href != null) { try { uri = cat.resolveUri(href); } catch (Exception e) { factory.appendErr(" ** Invalid documentation href = " + href + " " + e.getMessage() + "\n"); } } InvDocumentation doc = new InvDocumentation(href, uri, title, type, content); // LOOK XHTML ?? !! if (InvCatalogFactory.debugXML) System.out.println(" Documentation added: " + doc); return doc; }
protected InvDocumentation readDocumentation( InvCatalog cat, Element s) { String href = s.getAttributeValue("href", xlinkNS); String title = s.getAttributeValue("title", xlinkNS); String type = s.getAttributeValue("type"); // not XLink type String content = s.getTextNormalize(); URI uri = null; if (href != null) { try { uri = cat.resolveUri(href); } catch (Exception e) { factory.appendErr(" ** Invalid documentation href = "+href+" "+e.getMessage()+"\n"); } } InvDocumentation doc = new InvDocumentation( href, uri, title, type, content); // LOOK XHTML ?? !! if (InvCatalogFactory.debugXML) System.out.println (" Documentation added: "+ doc); return doc; }
protected InvDatasetImpl readDataset( InvCatalogImpl catalog, InvDatasetImpl parent, Element dsElem, URI base) { // deal with aliases String name = dsElem.getAttributeValue("name"); String alias = dsElem.getAttributeValue("alias"); if (alias != null) { InvDatasetImpl ds = (InvDatasetImpl) catalog.findDatasetByID( alias); if (ds == null) factory.appendErr(" ** Parse error: dataset named "+name+" has illegal alias = "+alias+"\n"); return new InvDatasetImplProxy(name, ds); } InvDatasetImpl dataset = new InvDatasetImpl( parent, name); readDatasetInfo( catalog, dataset, dsElem, base); if (InvCatalogFactory.debugXML) System.out.println (" Dataset added: "+ dataset.dump()); return dataset; }
protected InvDatasetImpl readDataset(InvCatalogImpl catalog, InvDatasetImpl parent, Element dsElem, URI base) { // deal with aliases String name = dsElem.getAttributeValue("name"); String alias = dsElem.getAttributeValue("alias"); if (alias != null) { InvDatasetImpl ds = (InvDatasetImpl) catalog.findDatasetByID(alias); if (ds == null) { factory.appendErr(" ** Parse error: dataset named " + name + " has illegal alias = " + alias + "\n"); return null; } return new InvDatasetImplProxy(name, ds); } InvDatasetImpl dataset = new InvDatasetImpl(parent, name); readDatasetInfo(catalog, dataset, dsElem, base); if (InvCatalogFactory.debugXML) System.out.println(" Dataset added: " + dataset.dump()); return dataset; }
protected InvDatasetImpl readDataset(InvCatalogImpl catalog, InvDatasetImpl parent, Element dsElem, URI base) { // deal with aliases String name = dsElem.getAttributeValue("name"); String alias = dsElem.getAttributeValue("alias"); if (alias != null) { InvDatasetImpl ds = (InvDatasetImpl) catalog.findDatasetByID(alias); if (ds == null) { factory.appendErr(" ** Parse error: dataset named " + name + " has illegal alias = " + alias + "\n"); return null; } return new InvDatasetImplProxy(name, ds); } InvDatasetImpl dataset = new InvDatasetImpl(parent, name); readDatasetInfo(catalog, dataset, dsElem, base); if (InvCatalogFactory.debugXML) System.out.println(" Dataset added: " + dataset.dump()); return dataset; }
protected ThreddsMetadata.Source readSource(Element elem) { if (elem == null) return null; ThreddsMetadata.Vocab name = readControlledVocabulary(elem.getChild("name", defNS)); Element contact = elem.getChild("contact", defNS); if (contact == null) { factory.appendErr(" ** Parse error: Missing contact element in = " + elem.getName() + "\n"); return null; } return new ThreddsMetadata.Source(name, contact.getAttributeValue("url"), contact.getAttributeValue("email")); }
protected ThreddsMetadata.Source readSource(Element elem) { if (elem == null) return null; ThreddsMetadata.Vocab name = readControlledVocabulary( elem.getChild("name", defNS)); Element contact = elem.getChild("contact", defNS); if (contact == null) { factory.appendErr(" ** Parse error: Missing contact element in = "+elem.getName()+"\n"); return null; } return new ThreddsMetadata.Source( name, contact.getAttributeValue("url"), contact.getAttributeValue("email")); }
protected ThreddsMetadata.Source readSource(Element elem) { if (elem == null) return null; ThreddsMetadata.Vocab name = readControlledVocabulary(elem.getChild("name", defNS)); Element contact = elem.getChild("contact", defNS); if (contact == null) { factory.appendErr(" ** Parse error: Missing contact element in = " + elem.getName() + "\n"); return null; } return new ThreddsMetadata.Source(name, contact.getAttributeValue("url"), contact.getAttributeValue("email")); }