Refine search
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; }
public CommandSnippet parse(String xmlContent, String fileName, String relativeFilePath) { try { Document document = buildXmlDocument(xmlContent, CommandSnippet.class.getResource("command-snippet.xsd")); CommandSnippetComment comment = getComment(document); Element execTag = document.getRootElement(); String commandName = execTag.getAttributeValue("command"); List<String> arguments = new ArrayList<>(); for (Object child : execTag.getChildren()) { Element element = (Element) child; arguments.add(element.getValue()); } return new CommandSnippet(commandName, arguments, comment, fileName, relativeFilePath); } catch (Exception e) { String errorMessage = String.format("Reason: %s", e.getMessage()); LOGGER.info("Could not load command '{}'. {}", fileName, errorMessage); return CommandSnippet.invalid(fileName, errorMessage, new EmptySnippetComment()); } }
public void assignTo(Element element) { if (!element.getName().equals(GeoTiffConstants.GEOTIFF_IIO_ROOT_ELEMENT_NAME)) { throw new IllegalArgumentException( "root not found: " + GeoTiffConstants.GEOTIFF_IIO_ROOT_ELEMENT_NAME); } final Element ifd1 = element.getChild(GeoTiffConstants.GEOTIFF_IFD_TAG); if (ifd1 == null) { throw new IllegalArgumentException( "Unable to find child " + GeoTiffConstants.GEOTIFF_IFD_TAG); } final Element ifd2 = createIFD(); ifd1.setAttribute( GeoTiffConstants.GEOTIFF_TAGSETS_ATT_NAME, ifd2.getAttributeValue(GeoTiffConstants.GEOTIFF_TAGSETS_ATT_NAME)); final Element[] childElems = (Element[]) ifd2.getChildren().toArray(new Element[0]); for (int i = 0; i < childElems.length; i++) { final Element child = childElems[i]; ifd2.removeContent(child); ifd1.addContent(child); } }
protected Optional<Boolean> readSort(Element sorterElem) { Element lexSortElem = sorterElem.getChild("lexigraphicByName", Catalog.defNS); if (lexSortElem != null) { String increasingString = lexSortElem.getAttributeValue("increasing"); if (increasingString != null) { if (increasingString.equalsIgnoreCase("true")) return Optional.of(true); else if (increasingString.equalsIgnoreCase("false")) return Optional.of(false); } } return Optional.empty(); }
/** * Parses a JDOM Element as defined in * <a href="http://jpos.org/minigl.dtd">minigl.dtd</a> */ public void fromXML (Element elem) throws ParseException { setDetail (elem.getChildTextTrim ("detail")); setTags (new Tags(elem.getChildTextTrim ("tags"))); setCredit ("credit".equals (elem.getAttributeValue("type"))); setLayer(toShort(elem.getAttributeValue("layer"))); setAmount(new BigDecimal (elem.getChild ("amount").getText())); } /**
public PointSpreadFunctions fromXml( final Element allPSFs, final File basePath ) throws SpimDataException { final PointSpreadFunctions pointSpreadFunctions = super.fromXml( allPSFs ); for ( final Element psfElement : allPSFs.getChildren( PSF_TAG ) ) { final int tpId = Integer.parseInt( psfElement.getAttributeValue( PSF_TIMEPOINT_ATTRIBUTE_NAME ) ); final int vsId = Integer.parseInt( psfElement.getAttributeValue( PSF_SETUP_ATTRIBUTE_NAME ) ); final String file = psfElement.getChildText( PSF_FILE_TAG ); pointSpreadFunctions.addPSF( new ViewId( tpId, vsId ), new PointSpreadFunction( basePath, file ) ); } return pointSpreadFunctions; }
public MessageObject(Element element){ this.comment = element.getAttributeValue("comment"); this.namespace = element.getAttributeValue("javaPackage"); this.className = element.getAttributeValue("name"); this.importPackage = element.getAttributeValue("importPackage"); this.cmdType = element.getAttributeValue("cmdType"); this.vm = element.getAttributeValue("vm"); for(Element child : element.getChildren()){ fieldList.add(new FieldObject(child)); } }
private static GtfsRoute getGtfsRoute(Document doc) { // Get the params from the XML doc Element rootNode = doc.getRootElement(); Element route = rootNode.getChild("route"); String routeId = route.getAttributeValue("tag"); String title = route.getAttributeValue("title"); String color = route.getAttributeValue("color"); String oppositeColor = route.getAttributeValue("oppositeColor"); // Create and return the GtfsRoute GtfsRoute gtfsRoute = new GtfsRoute(routeId, agencyId.getValue(), null, title, gtfsRouteType.getValue(), color, oppositeColor); return gtfsRoute; }
void check(Element e, Indent indent) { String name = e.getName(); if (name.equals("beanObject")) { String key = e.getAttributeValue("key"); Element obj = e.getChild("object"); assert obj != null; String c = obj.getAttributeValue("class"); System.out.printf("%s%s key=%s class=%s%n", indent, name, key, c); } for (Object co : e.getChildren()) check((Element)co,indent); }
/** Sets the work's properties from the pre-processed, transformed works XML */ private void setFromWorkXML(MCRWork work, Element workXML) { Element mods = workXML.getChild("mods", MCRConstants.MODS_NAMESPACE).detach(); String bibTeX = workXML.getChildTextTrim("bibTeX"); Optional<Element> modsFromBibTeX = bibTeX2MODS(bibTeX); modsFromBibTeX.ifPresent(m -> MCRMergeTool.merge(mods, m)); work.setMODS(mods); String sourceID = workXML.getAttributeValue("source"); work.setSource(MCRWorkSource.getInstance(sourceID)); if (work.getSource().isThisApplication()) { String oid = workXML.getAttributeValue("oid"); work.setObjectID(MCRObjectID.getInstance(oid)); } }
public MacroObject(Element element){ this.className = element.getAttributeValue("name"); this.namespace = element.getAttributeValue("javaPackage"); this.comment = element.getAttributeValue("comment"); this.vm = element.getAttributeValue("vm"); for(Element child : element.getChildren()){ fieldList.add(new FieldObject(child)); } allMacros.put(this.className, this); }
/** * @param e element to parse * @param md metadata to fill in */ private void parseRights(final Element e, final Metadata md) { final Element rightsElement = e.getChild("rights", getNS()); if (rightsElement != null && rightsElement.getAttributeValue("status") != null) { md.setRights(RightsStatus.valueOf(rightsElement.getAttributeValue("status"))); } }
public void unbindMaterials(final Element bindMaterial) { if (bindMaterial == null || bindMaterial.getChildren().isEmpty()) { return; } for (final Element instance : bindMaterial.getChild("technique_common").getChildren("instance_material")) { _dataCache.unbindMaterial(instance.getAttributeValue("symbol")); } }
private void readLinks(Representation resource, Element element) { List<Element> links = element.getChildren("link"); for (Element link : links) { String rel = link.getAttributeValue(REL); String href = link.getAttributeValue(HREF); String name = link.getAttributeValue(NAME); String title = link.getAttributeValue(TITLE); String hreflang = link.getAttributeValue(HREFLANG); String profile = link.getAttributeValue(PROFILE); resource.withLink(rel, href, name, title, hreflang, profile); } }
@Override public Module parse(final Element element, final Locale locale) { final ThreadingModule tm = new ThreadingModuleImpl(); Element inReplyTo = element.getChild("in-reply-to", ThreadingModuleParser.NS); if (inReplyTo != null) { tm.setHref(inReplyTo.getAttributeValue("href")); tm.setRef(inReplyTo.getAttributeValue("ref")); tm.setSource(inReplyTo.getAttributeValue("source")); tm.setType(inReplyTo.getAttributeValue("type")); return tm; } return null; } }
public void bindMaterials(final Element bindMaterial) { if (bindMaterial == null || bindMaterial.getChildren().isEmpty()) { return; } for (final Element instance : bindMaterial.getChild("technique_common").getChildren("instance_material")) { final Element matNode = _colladaDOMUtil.findTargetWithId(instance.getAttributeValue("target")); if (matNode != null && "material".equals(matNode.getName())) { _dataCache.bindMaterial(instance.getAttributeValue("symbol"), matNode); } else { logger.warning("instance material target not found: " + instance.getAttributeValue("target")); } // TODO: need to store bound vert data as local data. (also unstore on unbind.) } }
private Map loadProperties(Element elem) { Map props = new HashMap (); for (Element prop : elem.getChildren ("property")) { String name = prop.getAttributeValue ("name"); String value = prop.getAttributeValue ("value"); props.put (name, value); } return props; }
private void readSelector(Element elem, Selector s) { s.setTitle(elem.getAttributeValue("title")); s.setId(elem.getAttributeValue("id")); s.setTemplate(elem.getAttributeValue("template")); s.setRequired(elem.getAttributeValue("required")); s.setMultiple(elem.getAttributeValue("multiple")); Element descElem = elem.getChild("description", defNS); if (descElem != null) s.setDescription(readDocumentation(descElem)); }
protected ThreddsMetadata.GeospatialCoverage readGeospatialCoverage(Element gcElem) { if (gcElem == null) return null; String zpositive = gcElem.getAttributeValue("zpositive"); ThreddsMetadata.Range northsouth = readGeospatialRange(gcElem.getChild("northsouth", defNS), CDM.LAT_UNITS); ThreddsMetadata.Range eastwest = readGeospatialRange(gcElem.getChild("eastwest", defNS), CDM.LON_UNITS); ThreddsMetadata.Range updown = readGeospatialRange(gcElem.getChild("updown", defNS), "m"); // look for names List<ThreddsMetadata.Vocab> names = new ArrayList<>(); java.util.List<Element> list = gcElem.getChildren("name", defNS); for (Element e : list) { ThreddsMetadata.Vocab name = readControlledVocabulary(e); names.add(name); } return new ThreddsMetadata.GeospatialCoverage(eastwest, northsouth, updown, names, zpositive); }
private String constructName(final Element headOrFoot) { if (headOrFoot.getName().equalsIgnoreCase("NAME")) { return headOrFoot.getAttributeValue("text"); } String name = ""; for (final Element nameElement : headOrFoot.getChildren()) { if (name.equalsIgnoreCase("")) name = nameElement.getAttributeValue("text"); else name = name + "." + nameElement.getAttributeValue("text"); } return name; }