当前位置: 首页>>代码示例>>Java>>正文


Java Element.getAttributeValue方法代码示例

本文整理汇总了Java中org.jdom2.Element.getAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getAttributeValue方法的具体用法?Java Element.getAttributeValue怎么用?Java Element.getAttributeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jdom2.Element的用法示例。


在下文中一共展示了Element.getAttributeValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: containsClinicalDocumentTemplateId

import org.jdom2.Element; //导入方法依赖的package包/类
private boolean containsClinicalDocumentTemplateId(Element rootElement) {
	boolean containsTemplateId = false;

	List<Element> clinicalDocumentChildren = rootElement.getChildren(TEMPLATE_ID,
																		rootElement.getNamespace());

	for (Element currentChild : clinicalDocumentChildren) {
		final String root = currentChild.getAttributeValue(ROOT_STRING);
		final String extension = currentChild.getAttributeValue(EXTENSION_STRING);

		if (TemplateId.getTemplateId(root, extension, context) == TemplateId.CLINICAL_DOCUMENT) {
			containsTemplateId = true;
			break;
		}
	}
	return containsTemplateId;
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:18,代码来源:QrdaXmlDecoder.java

示例2: readMesasurementFilesFromSafe

import org.jdom2.Element; //导入方法依赖的package包/类
/**
 * Return the mesaurements
 * 
 * @return
 */
public void readMesasurementFilesFromSafe() {
	XPathExpression<Element> expr = xFactory
			.compile(
					"/xfdu:XFDU/dataObjectSection/dataObject[@repID='s1Level1ProductSchema']/byteStream/fileLocation",
					Filters.element(), null, xfdu);

	List<Element> values = expr.evaluate(safe);
	this.measurements=new File[values.size()];
	
	File safefile = new File(safePath);
	String measurementPath = safefile.getParent() + "/measurement";

	for (int i = 0; i < values.size(); i++) {
		Element e = values.get(i);
		String href = e.getAttributeValue("href");
		if (href.startsWith("./"))
			href = href.substring(2);
		measurements[i] = new File(measurementPath + "/" + href);
		System.out.println(measurements[i]);
	}

}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:28,代码来源:SumoSafeReader.java

示例3: parseDefinition

import org.jdom2.Element; //导入方法依赖的package包/类
public static ProximityAlarmDefinition parseDefinition(MapModuleContext context, Element elAlarm) throws InvalidXMLException {
    ProximityAlarmDefinition definition = new ProximityAlarmDefinition();
    FilterParser filterParser = context.needModule(FilterParser.class);
    definition.detectFilter = filterParser.parseProperty(elAlarm, "detect");
    definition.alertFilter = filterParser.property(elAlarm, "notify").optionalGet(() -> new InverseFilter(definition.detectFilter));
    definition.detectRegion = context.needModule(RegionParser.class).property(elAlarm, "region").required();
    definition.alertMessage = elAlarm.getAttributeValue("message"); // null = no message

    if(definition.alertMessage != null) {
        definition.alertMessage = ChatColor.translateAlternateColorCodes('`', definition.alertMessage);
    }
    Attribute attrFlareRadius = elAlarm.getAttribute("flare-radius");
    definition.flares = attrFlareRadius != null;
    if(definition.flares) {
        definition.flareRadius = XMLUtils.parseNumber(attrFlareRadius, Double.class);
    }

    return definition;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:20,代码来源:ProximityAlarmModule.java

示例4: parse

import org.jdom2.Element; //导入方法依赖的package包/类
@Override
public @Nullable ProjectileModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException {
    final ItemParser itemParser = context.needModule(ItemParser.class);
    FilterParser filterParser = context.needModule(FilterParser.class);

    for(Element projectileElement : XMLUtils.flattenElements(doc.getRootElement(), "projectiles", "projectile")) {
        String name = projectileElement.getAttributeValue("name");
        Double damage = XMLUtils.parseNumber(projectileElement.getAttribute("damage"), Double.class, (Double) null);
        double velocity = XMLUtils.parseNumber(Node.fromChildOrAttr(projectileElement, "velocity"), Double.class, 1.0);
        ClickAction clickAction = XMLUtils.parseEnum(Node.fromAttr(projectileElement, "click"), ClickAction.class, "click action", ClickAction.BOTH);
        Class<? extends Entity> entity = XMLUtils.parseEntityTypeAttribute(projectileElement, "projectile", Arrow.class);
        List<PotionEffect> potionKit = itemParser.parsePotionEffects(projectileElement);
        Filter destroyFilter = filterParser.parseOptionalProperty(projectileElement, "destroy-filter").orElse(null);
        Duration coolDown = XMLUtils.parseDuration(projectileElement.getAttribute("cooldown"));
        boolean throwable = XMLUtils.parseBoolean(projectileElement.getAttribute("throwable"), true);

        context.features().define(projectileElement, new ProjectileDefinitionImpl(name, damage, velocity, clickAction, entity, potionKit, destroyFilter, coolDown, throwable));
    }

    return null;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:22,代码来源:ProjectileModule.java

示例5: createSimpleNamedEntityTag

import org.jdom2.Element; //导入方法依赖的package包/类
/**
 * @param tag
 * @return
 */
private static String createSimpleNamedEntityTag(Element tag) {
    String neLabel = tag.getAttributeValue("LABEL");
    String neType = tag.getAttributeValue("TYPE");

    StringBuilder sb = new StringBuilder();
    sb.append(neType);
    sb.append('_');
    sb.append(neLabel);

    return sb.toString();
}
 
开发者ID:intranda,项目名称:goobi-viewer-indexer,代码行数:16,代码来源:TextHelper.java

示例6: parseClasses

import org.jdom2.Element; //导入方法依赖的package包/类
private void parseClasses(Element root) {
	Iterator<Element> it = root.getChildren(ClamlConstants.CLASS_ELEMENT).iterator();
	Long count = 0l;
	while (it.hasNext()) {
		Element classElement = it.next();
		String code = classElement.getAttributeValue(ClamlConstants.CODE_ATTR);
		String kind = classElement.getAttributeValue(ClamlConstants.KIND_ATTR);
		if (!CommonUtil.isEmptyString(kind)) {
			if (classKinds.containsKey(kind)) {
				Map<String, Element> codeMap = classKinds.get(kind);
				if (!CommonUtil.isEmptyString(kind)) {
					if (!codeMap.containsKey(code)) {
						codeMap.put(code, classElement);
						count++;
					} else {
						throw new IllegalArgumentException(ClamlConstants.CLASS_ELEMENT + " " + ClamlConstants.KIND_ATTR + " '" + kind + "' - duplicate code " + code);
					}
				} else {
					throw new IllegalArgumentException(ClamlConstants.CLASS_ELEMENT + " " + ClamlConstants.CODE_ATTR + " empty");
				}
			} else {
				throw new IllegalArgumentException(ClamlConstants.CLASS_ELEMENT + " " + ClamlConstants.KIND_ATTR + " '" + kind + "' not declared");
			}
		} else {
			throw new IllegalArgumentException(ClamlConstants.CLASS_ELEMENT + " " + ClamlConstants.KIND_ATTR + " empty");
		}
	}
	jobOutput.println(ClamlConstants.CLASS_ELEMENT + ": " + count + " elements");
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:30,代码来源:ClamlImporter.java

示例7: getNullableAttribute

import org.jdom2.Element; //导入方法依赖的package包/类
public static String getNullableAttribute(Element el, String...attrs) {
    String text = null;
    for(String attr : attrs) {
        text = el.getAttributeValue(attr);
        if(text != null) break;
    }
    return text;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:9,代码来源:XMLUtils.java

示例8: parseClass

import org.jdom2.Element; //导入方法依赖的package包/类
private static PlayerClass parseClass(Element classEl, KitParser kitParser, String family) throws InvalidXMLException {
    String name = classEl.getAttributeValue("name");
    if(name == null) {
        throw new InvalidXMLException("class must have a name", classEl);
    }

    String description = classEl.getAttributeValue("description");
    if(description != null) {
        description = BukkitUtils.colorize(description);
    }

    String longdescription = classEl.getAttributeValue("longdescription");
    if(longdescription != null) {
        longdescription = BukkitUtils.colorize(longdescription);
    }

    boolean sticky = XMLUtils.parseBoolean(classEl.getAttribute("sticky"), false);

    ImmutableSet.Builder<Kit> kits = ImmutableSet.builder();
    for(Element kitEl : classEl.getChildren("kit")) {
        Kit kit = kitParser.parseElement(kitEl);
        kits.add(kit);
    }

    MaterialData icon = XMLUtils.parseMaterialData(Node.fromAttr(classEl, "icon"));

    boolean restrict = XMLUtils.parseBoolean(classEl.getAttribute("restrict"), false);

    return new PlayerClass(name, family, description, longdescription, sticky, kits.build(), icon, restrict);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:31,代码来源:ClassModule.java

示例9: generatePageDocuments

import org.jdom2.Element; //导入方法依赖的package包/类
/**
 * 
 * @param writeStrategy
 * @param dataFolders
 * @param pageCountStart
 * @param imageXPaths
 * @param downloadExternalImages
 * @throws FatalIndexerException
 */
public void generatePageDocuments(ISolrWriteStrategy writeStrategy, Map<String, Path> dataFolders, int pageCountStart, List<String> imageXPaths,
        boolean downloadExternalImages) throws FatalIndexerException {
    String xpath = "/lido:lido/lido:administrativeMetadata/lido:resourceWrap/lido:resourceSet";
    List<Element> resourceSetList = xp.evaluateToElements(xpath, null);
    if (resourceSetList == null || resourceSetList.isEmpty()) {
        // No pages
        return;
    }

    logger.info("Generating {} page documents (count starts at {})...", resourceSetList.size(), pageCountStart);

    if (imageXPaths == null || imageXPaths.isEmpty()) {
        logger.error("No init.lido.imageXPath configuration elements found, cannot add images!");
    }

    // TODO lambda instead of loop (find a way to preserve order first)
    //        resourceSetList.parallelStream().forEach(
    //                eleResourceSet -> generatePageDocument(eleResourceSet, String.valueOf(getNextIddoc(hotfolder.getSolrHelper())), null,
    //                        writeStrategy, dataFolders));
    int order = pageCountStart;
    for (Element eleResourceSet : resourceSetList) {
        String orderAttribute = eleResourceSet.getAttributeValue("sortorder", Configuration.getInstance().getNamespaces().get("lido"));
        // Extract page order info , if available
        if (orderAttribute != null) {
            order = Integer.valueOf(orderAttribute);
        }
        if (generatePageDocument(eleResourceSet, String.valueOf(getNextIddoc(hotfolder.getSolrHelper())), order, writeStrategy, dataFolders,
                imageXPaths, downloadExternalImages)) {
            order++;
        }
    }

    logger.info("Generated {} page documents.", writeStrategy.getPageDocsSize());
}
 
开发者ID:intranda,项目名称:goobi-viewer-indexer,代码行数:44,代码来源:LidoIndexer.java

示例10: getAllClass

import org.jdom2.Element; //导入方法依赖的package包/类
/**
 * Method of extract triples (subclassOf, equivalent class) from OWL file
 *
 * @throws IOException IOException
 */
public void getAllClass() throws IOException {
  List<?> classElements = rootNode.getChildren("Class", Namespace.getNamespace("owl", owl_namespace));

  for (int i = 0; i < classElements.size(); i++) {
    Element classElement = (Element) classElements.get(i);
    String className = classElement.getAttributeValue("about", Namespace.getNamespace("rdf", rdf_namespace));

    if (className == null) {
      className = classElement.getAttributeValue("ID", Namespace.getNamespace("rdf", rdf_namespace));
    }

    List<?> subclassElements = classElement.getChildren("subClassOf", Namespace.getNamespace("rdfs", rdfs_namespace));
    for (int j = 0; j < subclassElements.size(); j++) {
      Element subclassElement = (Element) subclassElements.get(j);
      String subclassName = subclassElement.getAttributeValue("resource", Namespace.getNamespace("rdf", rdf_namespace));
      if (subclassName == null) {
        Element allValuesFromEle = findChild("allValuesFrom", subclassElement);
        if (allValuesFromEle != null) {
          subclassName = allValuesFromEle.getAttributeValue("resource", Namespace.getNamespace("rdf", rdf_namespace));
          bw.write(cutString(className) + ",SubClassOf," + cutString(subclassName) + "\n");
        }
      } else {
        bw.write(cutString(className) + ",SubClassOf," + cutString(subclassName) + "\n");
      }

    }

    List equalClassElements = classElement.getChildren("equivalentClass", Namespace.getNamespace("owl", owl_namespace));
    for (int k = 0; k < equalClassElements.size(); k++) {
      Element equalClassElement = (Element) equalClassElements.get(k);
      String equalClassElementName = equalClassElement.getAttributeValue("resource", Namespace.getNamespace("rdf", rdf_namespace));

      if (equalClassElementName != null) {
        bw.write(cutString(className) + ",equivalentClass," + cutString(equalClassElementName) + "\n");
      }
    }

  }
}
 
开发者ID:apache,项目名称:incubator-sdap-mudrod,代码行数:45,代码来源:AggregateTriples.java

示例11: getTemplateId

import org.jdom2.Element; //导入方法依赖的package包/类
private TemplateId getTemplateId(final Element idElement) {
	String root = idElement.getAttributeValue(ROOT_STRING);
	String extension = idElement.getAttributeValue(EXTENSION_STRING);
	return TemplateId.getTemplateId(root, extension, context);
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:6,代码来源:QrdaXmlDecoder.java

示例12: getKind

import org.jdom2.Element; //导入方法依赖的package包/类
private static String getKind(Element classElement) {
	return classElement.getAttributeValue(ClamlConstants.KIND_ATTR);
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:4,代码来源:ClamlClassProcessor.java

示例13: getCode

import org.jdom2.Element; //导入方法依赖的package包/类
protected static String getCode(Element classElement) {
	return classElement.getAttributeValue(ClamlConstants.CODE_ATTR);
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:4,代码来源:ClamlClassProcessor.java

示例14: parseFlag

import org.jdom2.Element; //导入方法依赖的package包/类
public FlagDefinition parseFlag(Element el) throws InvalidXMLException {
    checkDeprecatedFilter(el);

    String name = el.getAttributeValue("name");
    boolean visible = XMLUtils.parseBoolean(el.getAttribute("show"), true);
    Boolean required = XMLUtils.parseBoolean(el.getAttribute("required"), null);
    DyeColor color = XMLUtils.parseDyeColor(el.getAttribute("color"), null);
    final Optional<TeamFactory> owner = teamParser.property(el, "owner").optional();
    double pointsPerCapture = XMLUtils.parseNumber(el.getAttribute("points"), Double.class, 0D);
    double pointsPerSecond = XMLUtils.parseNumber(el.getAttribute("points-rate"), Double.class, 0D);
    Filter pickupFilter = filterParser.property(el, "pickup-filter").optional(null);
    if(pickupFilter == null) pickupFilter = filterParser.property(el, "filter").optional(StaticFilter.ALLOW);
    Filter dropFilter = filterParser.property(el, "drop-filter").optional(StaticFilter.ALLOW);
    Filter captureFilter = filterParser.property(el, "capture-filter").optional(StaticFilter.ALLOW);
    Kit pickupKit = kitParser.property(el, "pickup-kit").optional(null);
    Kit dropKit = kitParser.property(el, "drop-kit").optional(null);
    Kit carryKit = kitParser.property(el, "carry-kit")
                            .validate(RemovableValidation.get())
                            .optional(null);
    boolean multiCarrier = XMLUtils.parseBoolean(el.getAttribute("shared"), false);
    BaseComponent carryMessage = XMLUtils.parseFormattedText(el, "carry-message");
    boolean dropOnWater = XMLUtils.parseBoolean(el.getAttribute("drop-on-water"), true);
    boolean showBeam = XMLUtils.parseBoolean(el.getAttribute("beam"), true);
    ProximityMetric flagProximityMetric = ProximityMetric.parse(el, "flag", new ProximityMetric(ProximityMetric.Type.CLOSEST_KILL, false));
    ProximityMetric netProximityMetric = ProximityMetric.parse(el, "net", new ProximityMetric(ProximityMetric.Type.CLOSEST_PLAYER, false));

    Post defaultPost;
    Element elPost = XMLUtils.getUniqueChild(el, "post");
    if(elPost != null) {
        // Parse nested <post>
        defaultPost = this.parsePost(elPost);
    } else {
        Node postAttr = Node.fromRequiredAttr(el, "post");
        defaultPost = context.features().reference(postAttr, Post.class);
        if(defaultPost == null) {
            throw new InvalidXMLException("No post with ID '" + postAttr.getValue() + "'", postAttr);
        }
    }

    FlagDefinition flag = context.features().define(el, FlagDefinition.class, new FlagDefinitionImpl(name, required, visible, color, defaultPost, owner, pointsPerCapture, pointsPerSecond, pickupFilter, dropFilter, captureFilter, pickupKit, dropKit, carryKit, multiCarrier, carryMessage, dropOnWater, showBeam, flagProximityMetric, netProximityMetric));
    flags.add(flag);

    // Parse nested <net>s
    for(Element elNet : el.getChildren("net")) {
        this.parseNet(elNet, flag);
    }

    return flag;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:50,代码来源:FlagParser.java

示例15: parseElement

import org.jdom2.Element; //导入方法依赖的package包/类
@Override
public ControlPointDefinition parseElement(Element elControlPoint) throws InvalidXMLException {
    final boolean koth = "hill".equals(elControlPoint.getName());

    Region captureRegion = regionParser.property(elControlPoint, "capture-region")
                                       .alias("capture")
                                       .union();
    Region progressDisplayRegion = regionParser.property(elControlPoint, "progress-display-region")
                                               .alias("progress-display", "progress")
                                               .validate(BlockBoundedValidation.INSTANCE)
                                               .optionalUnion(null);
    Region ownerDisplayRegion = regionParser.property(elControlPoint, "owner-display-region")
                                            .alias("owner-display", "captured")
                                            .validate(BlockBoundedValidation.INSTANCE)
                                            .optionalUnion(null);
    Filter captureFilter = filterParser.property(elControlPoint, "capture-filter").optional(null);
    Filter playerFilter = filterParser.property(elControlPoint, "player-filter").optional(null);

    Filter visualMaterials = filterParser.property(elControlPoint, "visual-materials")
                                         .optionalMulti()
                                         .<Filter>map(AnyFilter::new)
                                         .orElse(VISUAL_MATERIALS);

    String name = elControlPoint.getAttributeValue("name", "Hill");
    TeamFactory initialOwner = teamParser.property(elControlPoint, "initial-owner").optional(null);
    Vector capturableDisplayBeacon = XMLUtils.parseVector(elControlPoint.getAttribute("beacon"));
    Duration timeToCapture = XMLUtils.parseDuration(elControlPoint.getAttribute("capture-time"), Duration.ofSeconds(30));

    double timeMultiplier = XMLUtils.parseNumber(elControlPoint.getAttribute("time-multiplier"), Double.class, koth ? 0.1D : 0D);

    final double recoveryRate, decayRate;
    final Node attrIncremental = Node.fromAttr(elControlPoint, "incremental");
    final Node attrRecovery = Node.fromAttr(elControlPoint, "recovery");
    final Node attrDecay = Node.fromAttr(elControlPoint, "decay");

    if(attrIncremental == null) {
        recoveryRate = XMLUtils.parseNumber(attrRecovery, Double.class, Range.atLeast(0D), koth ? 1D : Double.POSITIVE_INFINITY);
        decayRate = XMLUtils.parseNumber(attrDecay, Double.class, Range.atLeast(0D), koth ? 0D : Double.POSITIVE_INFINITY);
    } else {
        if(attrRecovery != null || attrDecay != null) {
            throw new InvalidXMLException("Cannot combine this attribute with 'incremental'", attrRecovery != null ? attrRecovery : attrDecay);
        }
        final boolean incremental = XMLUtils.parseBoolean(attrIncremental, koth);
        recoveryRate = incremental ? 1D : Double.POSITIVE_INFINITY;
        decayRate = incremental ? 0D : Double.POSITIVE_INFINITY;
    }

    boolean neutralState = XMLUtils.parseBoolean(elControlPoint.getAttribute("neutral-state"), koth);
    boolean permanent = XMLUtils.parseBoolean(elControlPoint.getAttribute("permanent"), false);
    float pointsOwned = XMLUtils.parseNumber(elControlPoint.getAttribute("owner-points"), Float.class, 0f);
    float pointsPerSecond = XMLUtils.parseNumber(elControlPoint.getAttribute("points"), Float.class, 1f);
    float pointsGrowth = XMLUtils.parseNumber(elControlPoint.getAttribute("points-growth"), Float.class, Float.POSITIVE_INFINITY);
    boolean showProgress = XMLUtils.parseBoolean(elControlPoint.getAttribute("show-progress"), koth);
    boolean visible = XMLUtils.parseBoolean(elControlPoint.getAttribute("show"), true);
    Boolean required = XMLUtils.parseBoolean(elControlPoint.getAttribute("required"), null);

    ControlPointDefinition.CaptureCondition captureCondition =
        XMLUtils.parseEnum(Node.fromAttr(elControlPoint, "capture-rule"),
                           ControlPointDefinition.CaptureCondition.class,
                           "capture rule",
                           ControlPointDefinition.CaptureCondition.EXCLUSIVE);

    return new ControlPointDefinitionImpl(
        name, required, visible,
        captureRegion, captureFilter, playerFilter,
        progressDisplayRegion, ownerDisplayRegion, visualMaterials,
        capturableDisplayBeacon == null ? null : capturableDisplayBeacon.toBlockVector(),
        timeToCapture, timeMultiplier, recoveryRate, decayRate, initialOwner, captureCondition,
        neutralState, permanent, pointsOwned, pointsPerSecond, pointsGrowth, showProgress
    );
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:72,代码来源:ControlPointParser.java


注:本文中的org.jdom2.Element.getAttributeValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。