本文整理匯總了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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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"));
}
示例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);
}
示例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);
}