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


Java Element.getAttribute方法代碼示例

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


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

示例1: handleRuntimeErrors

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * 
 * @param error
 * @return
 */
private DocumentPositionedInfo handleRuntimeErrors(Element error){
	String href = error.getAttributeValue("href");
	if (href == null || href.trim().length()==0)
		href = thePipelineURI;
	StringBuilder message = new StringBuilder();
	if (error.getAttribute("code") != null)
		message.append(error.getAttributeValue("code")+": ");
	if (error.getFirstChildElement("message") != null)
		message.append(error.getFirstChildElement("message").getValue());
	else
		message.append(error.getValue());
	
	return new DocumentPositionedInfo(DocumentPositionedInfo.SEVERITY_ERROR,
			message.toString(), href, 
			getPositionInfo(error.getAttributeValue("line")),
			getPositionInfo(error.getAttributeValue("column")));
}
 
開發者ID:xml-project,項目名稱:support-for-xmleditor,代碼行數:23,代碼來源:Adapter.java

示例2: handleCompilationError

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * 
 * @param error
 * @return
 */
private DocumentPositionedInfo handleCompilationError(Element error){
	Element position = error.getFirstChildElement("position");
	String href = position.getAttributeValue("href");
	if (href == null || href.trim().length()==0)
		href = thePipelineURI;
	StringBuilder message = new StringBuilder();
	if (error.getAttribute("code")!=null)
		message.append("err:"+error.getAttributeValue("code")+": ");
	message.append(error.getFirstChildElement("description").getValue()+" ("+error.getFirstChildElement("message").getValue()+")");
	return new DocumentPositionedInfo(DocumentPositionedInfo.SEVERITY_ERROR, 
			message.toString(), href, 
			getPositionInfo(position.getAttributeValue("line")), getPositionInfo(position.getAttributeValue("column")));
}
 
開發者ID:xml-project,項目名稱:support-for-xmleditor,代碼行數:19,代碼來源:Adapter.java

示例3: settipAttr

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * Method to set the attributes for time in phase.
 * @param The attribute to set
 * @param The value to set the attribute to. 
 */
public boolean settipAttr(String a, String value) {
	Element el = _root.getFirstChildElement("timeInPhase");
    Attribute attr = el.getAttribute(a);
    if (attr == null)
       el.addAttribute(new Attribute(a, value));
    else
        attr.setValue(value);
    return(true);
}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:15,代碼來源:PSPImpl.java

示例4: setdiAttr

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * Method to set the attributes for defects injected.
 * @param The attribute to set
 * @param The value to set the attribute to. 
 */
public boolean setdiAttr(String a, String value) {
	Element el = _root.getFirstChildElement("defectInjected");
    Attribute attr = el.getAttribute(a);
    if (attr == null)
       el.addAttribute(new Attribute(a, value));
    else
        attr.setValue(value);
    return(true);
}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:15,代碼來源:PSPImpl.java

示例5: setsumAttr

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * Method to set the attributes for summary.
 * @param The attribute to set
 * @param The value to set the attribute to. 
 */
public boolean setsumAttr(String a, String value) {
	Element el = _root.getFirstChildElement("summary");
    Attribute attr = el.getAttribute(a);
    if (attr == null)
       el.addAttribute(new Attribute(a, value));
    else
        attr.setValue(value);
    return(true);
}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:15,代碼來源:PSPImpl.java

示例6: upgrade1_1d1

import nu.xom.Element; //導入方法依賴的package包/類
private static void upgrade1_1d1(String[] projectIds) {
        for (int i = 0; i < projectIds.length; i++) {
            Util.debug("Upgrading project " + projectIds[i] + " from version 1.0 to version 1.1d1");
        
            String filePath = FileStorage.JN_DOCPATH + projectIds[i] + File.separator + ".tasklist";
            Document doc = FileStorage.openDocument(filePath);
                        
            Element root = doc.getRootElement();
            Elements tasks = root.getChildElements("task");
                        
            for (int j = 0; j < tasks.size(); j++) {                                
                Element task = tasks.get(j );

//	Decided not to change the date format after all but I'm leaving this code here 
//	in case we need it later. Ryan
//                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//
//                Attribute startDateAttr = task.getAttribute("startDate");
//                Date startDate = (new CalendarDate(startDateAttr.getValue(),"/")).getDate();
//                startDateAttr.setValue(sdf.format(startDate));
//
//                Attribute endDateAttr = task.getAttribute("endDate");
//                if (endDateAttr != null) {
//                    Date endDate = (new CalendarDate(endDateAttr.getValue(),"/")).getDate();
//                    endDateAttr.setValue(sdf.format(endDate));                    
//                }
                
                Attribute parentAttr = task.getAttribute("parent");
            	if ((parentAttr == null) || (parentAttr.getValue() == "")) {
            		// no parent, do nothing here
            	}
            	else {
                	// put the task under the parent task
                    String parentId = parentAttr.getValue();
                    for (int k = 0; k < tasks.size(); k++) {
                        Element potentialParent = tasks.get(k);
                        if(parentId.equals(potentialParent.getAttribute("id").getValue())) {
                            // found parent, put self under it
                            task.removeAttribute(parentAttr);
                            task.detach();
                            potentialParent.appendChild(task);                            
                        }
                    }
            	}            	
            }
            doc.setDocType(getCurrentDocType());
            FileStorage.saveDocument(doc,filePath);
        }        
    }
 
開發者ID:ser316asu,項目名稱:SER316-Dresden,代碼行數:50,代碼來源:TaskListVersioning.java


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