當前位置: 首頁>>代碼示例>>Java>>正文


Java Element.getValue方法代碼示例

本文整理匯總了Java中org.jdom2.Element.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.getValue方法的具體用法?Java Element.getValue怎麽用?Java Element.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jdom2.Element的用法示例。


在下文中一共展示了Element.getValue方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getConfig

import org.jdom2.Element; //導入方法依賴的package包/類
/**
 * 獲取指定名稱的Config配置
 * @return
 */
public Map<String,String> getConfig(String name) {
    Element rootEle = doc.getRootElement();
    Element elements = rootEle.getChild(name);

    Map<String,String> configMap = new HashMap<String, String>();
    if (elements != null) {
        List<Element> childElementList = elements.getChildren();
        for(Element childElement : childElementList) {
            String lname = childElement.getName();
            String lvalue = childElement.getValue();

            configMap.put(lname, lvalue);
        }
    }

    return configMap;
}
 
開發者ID:ninelook,項目名稱:wecard-server,代碼行數:22,代碼來源:ConfigHandler.java

示例2: readGeneralProductInformation

import org.jdom2.Element; //導入方法依賴的package包/類
/**
 * Read the generalProductInformation:
 * productType,instrumentConfigurationID,
 * missionDataTakeID,transmitterReceiverPolarisation
 * ,productTimelinessCategory,sliceProductFlag
 * 
 * @throws JAXBException
 * @throws SAXException
 */
public void readGeneralProductInformation() throws JAXBException,
		SAXException {
	String xPathGenProdInfo = "/xfdu:XFDU/metadataSection/metadataObject/metadataWrap/xmlData/*[name()='generalProductInformation']";
	String xPathStandAloneInfo = "/xfdu:XFDU/metadataSection/metadataObject/metadataWrap/xmlData/s1sarl1:standAloneProductInformation']";

	XPathExpression<Element> expr = xFactory.compile(xPathGenProdInfo,
			Filters.element(), null, xfdu);
	List<Element> value = expr.evaluate(safe);
	if (value == null || value.isEmpty()) {
		expr = xFactory.compile(xPathStandAloneInfo, Filters.element(),
				null, s1sarl1, xfdu);
		value = expr.evaluate(safe);
	}

	List<Element> informationsNode = value.get(0).getChildren();
	productInformation = new ProductInformation();

	for (Element e : informationsNode) {
		String name = e.getName();
		String val = e.getValue();
		productInformation.putValueInfo(name, val);
	}

}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:34,代碼來源:SumoSafeReader.java

示例3: readGeneralProductInformation

import org.jdom2.Element; //導入方法依賴的package包/類
public void readGeneralProductInformation() throws JAXBException,
		SAXException {
	String xPathGenProdInfo = "/xfdu:XFDU/metadataSection/metadataObject/metadataWrap/xmlData/*[name()='generalProductInformation']";
	String xPathStandAloneInfo = "/xfdu:XFDU/metadataSection/metadataObject/metadataWrap/xmlData/s1sarl1:standAloneProductInformation";

	XPathExpression<Element> expr = xFactory.compile(xPathGenProdInfo,
			Filters.element(), null, xfdu);
	List<Element> value = expr.evaluate(safe);
	if (value == null || value.isEmpty()) {
		expr = xFactory.compile(xPathStandAloneInfo, Filters.element(),
				null, s1sarl1, xfdu);
		value = expr.evaluate(safe);
	}

	List<Element> informationsNode = value.get(0).getChildren();
	productInformation = new ProductInformation();

	for (Element e : informationsNode) {
		String name = e.getName();
		String val = e.getValue();
		productInformation.putValueInfo(name, val);
	}

}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:25,代碼來源:SumoXPathSafeReader.java

示例4: parse

import org.jdom2.Element; //導入方法依賴的package包/類
public static GameRulesModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException {
    Map<GameRule, Boolean> gameRules = new HashMap<>();

    for (Element gameRulesElement : doc.getRootElement().getChildren("gamerules")) {
        for (Element gameRuleElement : gameRulesElement.getChildren()) {
            GameRule gameRule = GameRule.forName(gameRuleElement.getName());
            String value = gameRuleElement.getValue();

            if (gameRule == null) {
                throw new InvalidXMLException(gameRuleElement.getName() + " is not a valid gamerule", gameRuleElement);
            }
            if (value == null) {
                throw new InvalidXMLException("Missing value for gamerule " + gameRule.getValue(), gameRuleElement);
            } else if (!(value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false"))) {
                throw new InvalidXMLException(gameRuleElement.getValue() + " is not a valid gamerule value", gameRuleElement);
            }
            if (gameRules.containsKey(gameRule)){
                throw new InvalidXMLException(gameRule.getValue() + " has already been specified", gameRuleElement);
            }

            gameRules.put(gameRule, Boolean.valueOf(value));
        }
    }
    return new GameRulesModule(gameRules);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:26,代碼來源:GameRulesModule.java

示例5: checkValue

import org.jdom2.Element; //導入方法依賴的package包/類
private String checkValue(Element element) {
    if (element == null) {
        return null;
    }

    return element.getValue();
}
 
開發者ID:wseemann,項目名稱:Jaku,代碼行數:8,代碼來源:DeviceParser.java

示例6: getMCRIDs

import org.jdom2.Element; //導入方法依賴的package包/類
private List<String> getMCRIDs(PublicationAuthor author) throws IOException, JDOMException, SAXException {
    //prepare list of results blocks 
    String query = prepareAuthorQuery(author);

    //divide API request in blocks a 100 documents 
    int numberOfPublications = getNumberOfPublications(query);

    String pathToID = "result/doc/str[@name='id']";
   // String pathToID = "lst[@name='responseHeader']";
    
    XPathExpression<Element> xPath = XPathFactory.instance().compile(pathToID, Filters.element());
            
    List<String> foundMCRIds = new ArrayList<>();
    //at the moment only testing, two blocks a 10 documents
    for (int i = 0; i < ( (numberOfPublications / 100) + 1); i++) {
        int start = 100 * i;
                    //build API URL
        String queryURL = query + "&rows=100&start=" + start;
        Element response = getResponse(queryURL).asXML().detachRootElement().clone();
  
        List<Element> foundMCRIDElements = xPath.evaluate(response);
        LOGGER.info("found " + foundMCRIDElements.size() + " mods elements");
        for (Element mcrIDElement : foundMCRIDElements) {
        	String mcrID = mcrIDElement.getValue();
        	if (!mcrID.contains("-"))
        		foundMCRIds.add(mcrID);
        }
    }
    LOGGER.info("retrieved " + foundMCRIds.size() + " entries from MyCoRe repository.");
    //return API-response
    return foundMCRIds;
}
 
開發者ID:ETspielberg,項目名稱:bibliometrics,代碼行數:33,代碼來源:MyCoReConnector.java

示例7: updateCitationCount

import org.jdom2.Element; //導入方法依賴的package包/類
public Document updateCitationCount(Document doc) throws JDOMException, SAXException {
	Document newDoc = new Document();
	// extract DOI
	String doi = "";
	Element rootElement = doc.getRootElement();
	List<Element> children = rootElement.getChildren("identifier", MODS_NS);
	for (Element element : children) {
		List<Attribute> attributes = element.getAttributes();
		for (Attribute attribute : attributes) {
			if ("type".equals(attribute.getName()) && "doi".equals(attribute.getValue())) {
				doi = element.getValue();
			}
		}
	}
	// get Doc with new citation count
	try {
		newDoc = getPublicationByDOI(doi).asXML();
	} catch (IOException ex) {

	}

	// extract new citation count
	Element newRootElement = newDoc.getRootElement();
	Element newChild = newRootElement.getChild("extension", MODS_NS).getChild("sourcetext")
			.getChild("abstracts-retrieval-response", ELSEVIER_Namespace).getChild("coredata", ELSEVIER_Namespace)
			.getChild("citedby-count", ELSEVIER_Namespace);
	String newCitationCount = newChild.getValue();

	// replace old citation count
	Element child = rootElement.getChild("extension", MODS_NS).getChild("sourcetext")
			.getChild("abstracts-retrieval-response", ELSEVIER_Namespace).getChild("coredata", ELSEVIER_Namespace)
			.getChild("citedby-count", ELSEVIER_Namespace);
	child.setText(newCitationCount);

	return doc;

}
 
開發者ID:ETspielberg,項目名稱:bibliometrics,代碼行數:38,代碼來源:ScopusConnector.java

示例8: getServerUrl

import org.jdom2.Element; //導入方法依賴的package包/類
/**
 * 讀取目標測試服務器URL
 * @return
 */
public String getServerUrl() {
    Element rootEle = doc.getRootElement();
    Element serverUrlEle = rootEle.getChild("server-url");
    return serverUrlEle.getValue();
}
 
開發者ID:ninelook,項目名稱:wecard-server,代碼行數:10,代碼來源:SystemConfigHandler.java


注:本文中的org.jdom2.Element.getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。