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


Java Element.addAttribute方法代碼示例

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


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

示例1: Day

import nu.xom.Element; //導入方法依賴的package包/類
public Day(Element el) {
        dEl = el;
        // Added to fix old '.notes' XML format 
        // Old-style XML is converted on the fly [alexeya]
        if (dEl.getAttribute("date") != null) {
        	Attribute dAttr = dEl.getAttribute("date");
        	Attribute tAttr = dEl.getAttribute("title");
Element nEl = new Element("note");
String date = dAttr.getValue().replace('/', '-');
nEl.addAttribute(new Attribute("refid", date));
nEl.addAttribute(new Attribute("title", tAttr.getValue()));
dEl.appendChild(nEl);
        	dEl.removeAttribute(dAttr);            	
dEl.removeAttribute(tAttr);
        }
    }
 
開發者ID:ser316asu,項目名稱:SER316-Munich,代碼行數:17,代碼來源:NoteListImpl.java

示例2: createTask

import nu.xom.Element; //導入方法依賴的package包/類
public Task createTask(CalendarDate startDate, CalendarDate endDate, String text, int priority, int phase, long effort, long actual, String description, String parentTaskId) {
      Element el = new Element("task");
      el.addAttribute(new Attribute("startDate", startDate.toString()));
      el.addAttribute(new Attribute("endDate", endDate != null? endDate.toString():""));
String id = Util.generateId();
      el.addAttribute(new Attribute("id", id));
      el.addAttribute(new Attribute("progress", "0"));
      el.addAttribute(new Attribute("effort", String.valueOf(effort)));
      el.addAttribute(new Attribute("actual", String.valueOf(actual)));
      el.addAttribute(new Attribute("priority", String.valueOf(priority)));
      el.addAttribute(new Attribute("phase", String.valueOf(phase)));
              
      Element txt = new Element("text");
      txt.appendChild(text);
      el.appendChild(txt);

      Element desc = new Element("description");
      desc.appendChild(description);
      el.appendChild(desc);

      if (parentTaskId == null) {
          _root.appendChild(el);
      }
      else {
          Element parent = getTaskElement(parentTaskId);
          parent.appendChild(el);
      }
      
elements.put(id, el);

      Util.debug("Created task with parent " + parentTaskId);
      
      return new TaskImpl(el, this);
  }
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:35,代碼來源:TaskListImpl.java

示例3: createProject

import nu.xom.Element; //導入方法依賴的package包/類
public static Project createProject(String id, String title, CalendarDate startDate, CalendarDate endDate) {
    Element el = new Element("project");
    el.addAttribute(new Attribute("id", id));
    _root.appendChild(el);
    Project prj = new ProjectImpl(el);
    prj.setTitle(title);
    prj.setStartDate(startDate);
    prj.setEndDate(endDate);
    CurrentStorage.get().createProjectStorage(prj);
    return prj;
}
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:12,代碼來源:ProjectManager.java

示例4: addResource

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * @see net.sf.memoranda.ResourcesList#addResource(java.lang.String, boolean)
 */
public void addResource(String path, boolean isInternetShortcut, boolean isProjectFile) {
    Element el = new Element("resource");
    el.addAttribute(new Attribute("id", Util.generateId()));
    el.addAttribute(new Attribute("path", path));  
    if (isInternetShortcut)
        el.addAttribute(new Attribute("isInetShortcut", "true"));
    if (isProjectFile)
        el.addAttribute(new Attribute("isProjectFile", "true"));
    _root.appendChild(el);
}
 
開發者ID:ser316asu,項目名稱:SER316-Munich,代碼行數:14,代碼來源:ResourcesListImpl.java

示例5: addApp

import nu.xom.Element; //導入方法依賴的package包/類
public void addApp(String appId, String fp, String exec, String clp) {
    Element el = new Element("app");
    el.addAttribute(new Attribute("id", appId));
    el.addAttribute(new Attribute("command", clp));
    el.addAttribute(new Attribute("exec", exec));
    el.addAttribute(new Attribute("findPath", fp));
    _root.appendChild(el);
}
 
開發者ID:ser316asu,項目名稱:SER316-Dresden,代碼行數:9,代碼來源:AppList.java

示例6: createSticker

import nu.xom.Element; //導入方法依賴的package包/類
public static void createSticker(String text, int prior) {
	Element el = new Element("sticker");
	el.addAttribute(new Attribute("id", Util.generateId()));
	el.addAttribute(new Attribute("priority", prior+""));
	el.appendChild(text);
	_root.appendChild(el);
}
 
開發者ID:ser316asu,項目名稱:SER316-Aachen,代碼行數:8,代碼來源:EventsManager.java

示例7: createTask

import nu.xom.Element; //導入方法依賴的package包/類
public Task createTask(CalendarDate startDate, CalendarDate endDate, String text, int priority, long effort, 
  		String description, int defectNum, int defectRemCount, String parentTaskId) {
      Element el = new Element("task");
      el.addAttribute(new Attribute("startDate", startDate.toString()));
      el.addAttribute(new Attribute("endDate", endDate != null? endDate.toString():""));
String id = Util.generateId();
      el.addAttribute(new Attribute("id", id));
      el.addAttribute(new Attribute("progress", "0"));
      el.addAttribute(new Attribute("effort", String.valueOf(effort)));
      el.addAttribute(new Attribute("priority", String.valueOf(priority)));
      // added to create attribute for defect counts
      el.addAttribute(new Attribute("defectNum", Integer.toString(defectNum)));
      el.addAttribute(new Attribute("defectRemovedNum", Integer.toString(defectRemCount)));
              
      Element txt = new Element("text");
      txt.appendChild(text);
      el.appendChild(txt);

      Element desc = new Element("description");
      desc.appendChild(description);
      el.appendChild(desc);

      if (parentTaskId == null) {
          _root.appendChild(el);
      }
      else {
          Element parent = getTaskElement(parentTaskId);
          parent.appendChild(el);
      }
      
elements.put(id, el);

      Util.debug("Created task with parent " + parentTaskId);
      
      return new TaskImpl(el, this);
  }
 
開發者ID:ser316asu,項目名稱:Reinickendorf_SER316,代碼行數:37,代碼來源:TaskListImpl.java

示例8: setUp

import nu.xom.Element; //導入方法依賴的package包/類
@Before
public void setUp() {
    Element element = new Element("elem", "http://www.example.com/my");
    element.setNamespacePrefix("my");
    element.addAttribute(attr1);
    element.addAttribute(attr2);
    element.addAttribute(attr3);
    element.appendChild("text");
    element.appendChild(child1);
    element.appendChild(child2);
    element.appendChild(child3);

    node = new XomElement(element);
}
 
開發者ID:SimY4,項目名稱:xpath-to-xml,代碼行數:15,代碼來源:XomElementTest.java

示例9: setApp

import nu.xom.Element; //導入方法依賴的package包/類
public void setApp(String plafCode, String appId) {
    if (getAppId(plafCode) != null) {
        Elements apps = _root.getChildElements("app");
        for (int i = 0; i < apps.size(); i++)
            if (apps.get(i).getAttribute("platform").getValue().toLowerCase().equals(plafCode.toLowerCase()))
                apps.get(i).getAttribute("appId").setValue(appId);
    }
    else {
        Element app = new Element("app");
        app.addAttribute(new Attribute("appId", appId));
        app.addAttribute(new Attribute("platform", plafCode));
        _root.appendChild(app);
    }
}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:15,代碼來源:MimeType.java

示例10: addMimeType

import nu.xom.Element; //導入方法依賴的package包/類
public static MimeType addMimeType(String mimeId) {
    Element el = new Element("mime-type");
    el.addAttribute(new Attribute("id", mimeId));
    _root.appendChild(el);
    return new MimeType(el);
}
 
開發者ID:ser316asu,項目名稱:Reinickendorf_SER316,代碼行數:7,代碼來源:MimeTypesList.java

示例11: addDependsFrom

import nu.xom.Element; //導入方法依賴的package包/類
/**
 * @see net.sf.memoranda.Task#addDependsFrom(net.sf.memoranda.Task)
 */
public void addDependsFrom(Task task) {
    Element dep = new Element("dependsFrom");
    dep.addAttribute(new Attribute("idRef", task.getID()));
    _element.appendChild(dep);
}
 
開發者ID:ser316asu,項目名稱:Reinickendorf_SER316,代碼行數:9,代碼來源:TaskImpl.java

示例12: createMonth

import nu.xom.Element; //導入方法依賴的package包/類
private Month createMonth(int m) {
	Element el = new Element("month");
	el.addAttribute(new Attribute("month", new Integer(m).toString()));
	yearElement.appendChild(el);
	return new Month(el);
}
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:7,代碼來源:EventsManager.java

示例13: MimeType

import nu.xom.Element; //導入方法依賴的package包/類
public MimeType() {
  _root = new Element("default-type");
  _root.addAttribute(new Attribute("id", "__UNKNOWN"));
  _root.addAttribute(new Attribute("label", "Unknown"));
}
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:6,代碼來源:MimeType.java

示例14: createMonth

import nu.xom.Element; //導入方法依賴的package包/類
private Month createMonth(int m) {
    Element el = new Element("month");
    el.addAttribute(new Attribute("month", new Integer(m).toString()));
    yearElement.appendChild(el);
    return new Month(el);
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:7,代碼來源:NoteListImpl.java

示例15: createYear

import nu.xom.Element; //導入方法依賴的package包/類
private static Year createYear(int y) {
	Element el = new Element("year");
	el.addAttribute(new Attribute("year", new Integer(y).toString()));
	_root.appendChild(el);
	return new Year(el);
}
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:7,代碼來源:EventsManager.java


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