本文整理汇总了Java中processing.data.XML.getContent方法的典型用法代码示例。如果您正苦于以下问题:Java XML.getContent方法的具体用法?Java XML.getContent怎么用?Java XML.getContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.data.XML
的用法示例。
在下文中一共展示了XML.getContent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStringVal
import processing.data.XML; //导入方法依赖的package包/类
private static String getStringVal(XML itemXML, String tagName) {
// Sets title if existing
String str = null;
XML strXML = itemXML.getChild(tagName);
// check if node exists and has content
if (strXML != null && strXML.getContent() != null) {
str = strXML.getContent();
}
return str;
}
示例2: loadKeyBindings
import processing.data.XML; //导入方法依赖的package包/类
/**
* Load specified key bindings from the XML resource
*
* @param xml
*/
public void loadKeyBindings(XML xml) {
XML[] bindings = xml.getChildren();
for(XML binding : bindings) {
//Make sure that this is a "binding" element
if(!binding.getName().equals("binding"))
continue;
//Parse the key binding
String name = binding.getContent();
int key = binding.getInt("key");
//Load the list of possible key modifiers
String modifiers = binding.getString("mod");
String[] mods = modifiers.split("\\|"); // "|" is a REGEX keyword... need to escape it
//The possible modifiers (these are available in API level 11+)
boolean ctrl = false;
boolean meta = false;
boolean func = false;
// (and these are available across all API levels)
boolean alt = false;
boolean sym = false;
boolean shift = false;
//This isn't very elegant... but it gets the job done
for(String mod : mods) {
if(mod.equals("ctrl")) ctrl = true;
if(mod.equals("meta")) meta = true;
if(mod.equals("func")) func = true;
if(mod.equals("alt")) alt = true;
if(mod.equals("sym")) sym = true;
if(mod.equals("shift")) shift = true;
}
//Build the KeyBinding
KeyBinding bind = new KeyBinding(name, key, ctrl, meta, func, alt, sym, shift);
//Add the key binding
keyBindings.put(name, bind);
}
}