private Modification parseChangeset(Element changeset) { Date modifiedTime = DateUtils.parseRFC822(changeset.getChildText("date")); String author = org.apache.commons.lang3.StringEscapeUtils.unescapeXml(changeset.getChildText("author")); String comment = org.apache.commons.lang3.StringEscapeUtils.unescapeXml(changeset.getChildText("desc")); String revision = changeset.getChildText("node"); Modification modification = new Modification(author, comment, null, modifiedTime, revision); Element files = changeset.getChild("files"); List<File> modifiedFiles = parseFiles(files, "modified"); List<File> addedFiles = parseFiles(files, "added"); List<File> deletedFiles = parseFiles(files, "deleted"); modifiedFiles.removeAll(addedFiles); modifiedFiles.removeAll(deletedFiles); addModificationFiles(modification, ModifiedAction.added, addedFiles); addModificationFiles(modification, ModifiedAction.deleted, deletedFiles); addModificationFiles(modification, ModifiedAction.modified, modifiedFiles); return modification; }
private Modification parseLogEntry(Element logEntry, String path) throws ParseException { Element logEntryPaths = logEntry.getChild("paths"); if (logEntryPaths == null) { /* Path-based access control forbids us from learning * details of this log entry, so skip it. */ return null; } Date modifiedTime = convertDate(logEntry.getChildText("date")); String author = logEntry.getChildText("author"); String comment = logEntry.getChildText("msg"); String revision = logEntry.getAttributeValue("revision"); Modification modification = new Modification(author, comment, null, modifiedTime, revision); List paths = logEntryPaths.getChildren("path"); for (Iterator iterator = paths.iterator(); iterator.hasNext();) { Element node = (Element) iterator.next(); if (underPath(path, node.getText())) { ModifiedAction action = convertAction(node.getAttributeValue("action")); modification.createModifiedFile(node.getText(), null, action); } } return modification; }
protected Envelope parseBounding(Element bounding) { if (bounding == null) return new Envelope(); double minX = Double.parseDouble(bounding.getChildText("westbc")); double maxX = Double.parseDouble(bounding.getChildText("eastbc")); double minY = Double.parseDouble(bounding.getChildText("southbc")); double maxY = Double.parseDouble(bounding.getChildText("northbc")); return new Envelope(minX, maxX, minY, maxY); }
/** * @param name The name of the child. * @return the child text. * @see org.jdom2.Element#getChildText(java.lang.String) */ public String getChildText( String name ) { return element.getChildText( name ); }
/** * @param name The name of the child. * @param ns {@link Namespace} * @return the child text. * @see org.jdom2.Element#getChildText(java.lang.String,org.jdom2.Namespace) */ public String getChildText( String name, Namespace ns ) { return element.getChildText( name, ns ); }
private static String processElement(Element element, String format) { return String.format(format, element.getChildText("firstname"), element.getChildText("lastname"), element.getChildText("email"), element.getChildText("salary")); }
private String textOf(String childName) { String text = element.getChildText(childName, MCRConstants.MODS_NAMESPACE); return text == null ? "" : text.trim(); } }
@Override public OpenConnectomeImageLoader fromXml( final Element elem, final File basePath, final AbstractSequenceDescription< ?, ?, ? > sequenceDescription ) { final String baseUrl = elem.getChildText( "baseUrl" ); final String token = elem.getChildText( "token" ); final String mode = elem.getChildText( "mode" ); return new OpenConnectomeImageLoader( baseUrl, token, mode ); } }
@Override public Element parseFrom(Document document){ Element root = super.parseFrom(document); this.latitude = Float.parseFloat(root.getChildText("Latitude")); this.longitude = Float.parseFloat(root.getChildText("Longitude")); this.precision = Float.parseFloat(root.getChildText("Precision")); return root; } }
private void initWhoToSendTo() { Element persist = getPersist(); sendMethod = persist.getChildText("send-request"); if (sendMethod==null) { sendMethod="LAST"; } }
public static String getAltUnits(Document doc) throws IOException { Element root = doc.getRootElement(); String altUnits = root.getChildText("AltitudeUnits"); if (altUnits == null || altUnits.length() == 0) return null; return altUnits; }
protected void initializeFromXML( Element el ) { super.initializeFromXML( el ); m_path = el.getChildText("path"); }
public static DateUnit getTimeUnit(Document doc) throws IOException { Element root = doc.getRootElement(); String timeUnitS = root.getChildText("TimeUnit"); if (timeUnitS == null) return null; try { return new DateUnit(timeUnitS); } catch (Exception e) { log.error("Illegal date unit {}", timeUnitS); return null; } }
private Row createRow(Element cron) { Row row = new Row(); row.getCell().add(OfxCellFactory.createParagraphCell(cron.getChildText("url"))); row.getCell().add(OfxCellFactory.createParagraphCell(cron.getChildText("schedule"))); row.getCell().add(OfxCellFactory.createParagraphCell(cron.getChildText("description"))); return row; }
private void initIn() { Element persist = getPersist(); inQueue = persist.getChildText("in"); if (inQueue != null) { /* * We have an 'in' queue to monitor for messages we will * send out through server in our (SpaceListener)notify(Object, Object) method. */ sp.addListener(inQueue, this); } } private void initOut() {
public TimePoints readTimePoints() { final Element root = document.getRootElement(); final int nTimePoints = Integer.parseInt( root.getChild( "TimelapsCondition" ).getChildText( "Iteration" ) ); final List< TimePoint > timepoints = new ArrayList<>( nTimePoints ); for ( int i = 0; i < nTimePoints; i++ ) { timepoints.add( new TimePoint( Integer.valueOf( i ) ) ); } return new TimePoints( timepoints ); }
/** * Create a dataset-specific table from a jdom tree using the DSS parser * * @param paramTableElem the jdom tree * @throws IOException on io error */ public Grib1ParamTableReader(org.jdom2.Element paramTableElem) throws IOException { this.name = paramTableElem.getChildText("title"); DssParser p = new DssParser(Catalog.ncmlNS); this.parameters = p.parseXml(paramTableElem); }
protected ThreddsMetadata.Range readGeospatialRange(Element spElem, String defUnits) { if (spElem == null) return null; double start = readDouble(spElem.getChild("start", defNS)); double size = readDouble(spElem.getChild("size", defNS)); double resolution = readDouble(spElem.getChild("resolution", defNS)); String units = spElem.getChildText("units", defNS); if (units == null) units = defUnits; return new ThreddsMetadata.Range(start, size, resolution, units); }
protected ThreddsMetadata.Range readGeospatialRange( Element spElem, String defUnits) { if (spElem == null) return null; double start = readDouble( spElem.getChild("start", defNS)); double size = readDouble( spElem.getChild("size", defNS)); double resolution = readDouble( spElem.getChild("resolution", defNS)); String units = spElem.getChildText("units", defNS); if (units == null) units = defUnits; return new ThreddsMetadata.Range( start, size, resolution, units); }
protected ThreddsMetadata.Range readGeospatialRange(Element spElem, String defUnits) { if (spElem == null) return null; double start = readDouble(spElem.getChild("start", defNS)); double size = readDouble(spElem.getChild("size", defNS)); double resolution = readDouble(spElem.getChild("resolution", defNS)); String units = spElem.getChildText("units", defNS); if (units == null) units = defUnits; return new ThreddsMetadata.Range(start, size, resolution, units); }