本文整理匯總了Java中org.dom4j.Element.elements方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.elements方法的具體用法?Java Element.elements怎麽用?Java Element.elements使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.dom4j.Element
的用法示例。
在下文中一共展示了Element.elements方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseActions
import org.dom4j.Element; //導入方法依賴的package包/類
public List<Action> parseActions(Element element){
List<Action> actions=new ArrayList<Action>();
for(Object obj:element.elements()){
if(obj==null || !(obj instanceof Element)){
continue;
}
Element ele=(Element)obj;
String name=ele.getName();
for(ActionParser actionParser:actionParsers){
if(actionParser.support(name)){
actions.add(actionParser.parse(ele));
break;
}
}
}
return actions;
}
示例2: parseDatasetNode
import org.dom4j.Element; //導入方法依賴的package包/類
/** parse a dataset node from xml */
private static OozieDatasetNode parseDatasetNode(Element xml_node) {
List<Element> childNodes = xml_node.elements();
OozieDatasetNode node = new OozieDatasetNode();
for( Element child : childNodes){
String value = child.getText();
String name = child.getName();
if ("id".equals(name))
node.setId(value);
else if ("moduleId".equals(name))
node.setModuleId(value);
else if ("x".equals(name))
node.setX((int) Float.parseFloat(value));
else if ("y".equals(name))
node.setY((int) Float.parseFloat(value));
else if ("file".equals(name))
node.setFile(value);
}
return node;
}
示例3: parse
import org.dom4j.Element; //導入方法依賴的package包/類
@Override
public CheckboxInputComponent parse(Element element) {
CheckboxInputComponent checkbox=new CheckboxInputComponent();
checkbox.setBindParameter(element.attributeValue("bind-parameter"));
checkbox.setOptionsInline(Boolean.valueOf(element.attributeValue("options-inline")));
checkbox.setLabel(element.attributeValue("label"));
checkbox.setType(element.attributeValue("type"));
checkbox.setLabelPosition(LabelPosition.valueOf(element.attributeValue("label-position")));
List<Option> options=new ArrayList<Option>();
for(Object obj:element.elements()){
if(obj==null || !(obj instanceof Element)){
continue;
}
Element ele=(Element)obj;
if(!ele.getName().equals("option")){
continue;
}
Option option=new Option();
options.add(option);
option.setLabel(ele.attributeValue("label"));
option.setValue(ele.attributeValue("value"));
}
checkbox.setOptions(options);
return checkbox;
}
示例4: element2Map
import org.dom4j.Element; //導入方法依賴的package包/類
/**
* Element to map
* @param e
* @param map
*/
public static void element2Map(Element e, Map<String, Object> map) {
List<Object> list = e.elements();
if (e.attributeCount() > 0) {
for (Object attri : e.attributes()) {
Attribute at = (Attribute)attri;
map.put(at.getName(), at.getValue());
}
}
if (list.size() < 1 && DataUtil.isEmpty(e.getText())) {
return;
} else if (list.size() < 1 && !DataUtil.isEmpty(e.getText())) {
map.put("text", e.getText());
}
for (Object aList : list) {
Element iter = (Element)aList;
Map<String, Object> cMap = new HashMap<String, Object>();
element2Map(iter, cMap);
map.put(iter.getName(), cMap);
}
}
示例5: parseParameters
import org.dom4j.Element; //導入方法依賴的package包/類
private List<Parameter> parseParameters(Element element){
List<Parameter> parameters=new ArrayList<Parameter>();
for(Object obj:element.elements()){
if(obj==null || !(obj instanceof Element)){
continue;
}
Element ele=(Element)obj;
if(!ele.getName().equals("parameter")){
continue;
}
Parameter param=new Parameter();
param.setName(ele.attributeValue("name"));
param.setDefaultValue(ele.attributeValue("default-value"));
param.setType(DataType.valueOf(ele.attributeValue("type")));
parameters.add(param);
}
return parameters;
}
示例6: getKeysInXML
import org.dom4j.Element; //導入方法依賴的package包/類
/**
* 從指定的xml文件返回在zookeeper中的key集合
*
* @param fromDoc
* 源xml文件
* @param znodePath
* znode路徑前綴
* @return
*/
public static Set<String> getKeysInXML(Document fromDoc, String znodePath) {
Set<String> xmlKeys = new HashSet<>();
Element rootEle = fromDoc.getRootElement();
List<Element> paramsList = rootEle.elements("params");
for (Element paramEle : paramsList) {
String paramName = paramEle.attributeValue("name");
List<Element> paramList = paramEle.elements("param");
for (Element param : paramList) {
String paramKey = param.attributeValue("name");
xmlKeys.add(znodePath + "/" + paramName + "/" + paramKey);
}
}
return xmlKeys;
}
示例7: addEntityListenerClasses
import org.dom4j.Element; //導入方法依賴的package包/類
private List<String> addEntityListenerClasses(Element element, String packageName, List<String> addedClasses) {
List<String> localAddedClasses = new ArrayList<String>();
Element listeners = element.element( "entity-listeners" );
if ( listeners != null ) {
@SuppressWarnings( "unchecked" )
List<Element> elements = listeners.elements( "entity-listener" );
for (Element listener : elements) {
String listenerClassName = buildSafeClassName( listener.attributeValue( "class" ), packageName );
if ( classOverriding.containsKey( listenerClassName ) ) {
//maybe switch it to warn?
if ( "entity-listener".equals( classOverriding.get( listenerClassName ).getName() ) ) {
LOG.duplicateListener( listenerClassName );
continue;
}
throw new IllegalStateException("Duplicate XML entry for " + listenerClassName);
}
localAddedClasses.add( listenerClassName );
classOverriding.put( listenerClassName, listener );
}
}
LOG.debugf( "Adding XML overriding information for listeners: %s", localAddedClasses );
addedClasses.addAll( localAddedClasses );
return localAddedClasses;
}
示例8: parserVarList
import org.dom4j.Element; //導入方法依賴的package包/類
/**
* 解析list類型全局變量
* @param node vars節點
* @return 返回所有list類型變量
*/
public static Map<String,Object> parserVarList(Element node){
Map<String,Object> vars = new HashMap<String, Object>();
if(node!=null){
List<Element> childs = node.elements("list");
if(childs!=null&&childs.size()>0){
for(Element list : childs){
List<Element> itemsE = list.elements();
List<String> itemsContainer = new ArrayList<String>();
for(Element item : itemsE){
itemsContainer.add(item.getText());
}
vars.put(list.attributeValue("name"),itemsContainer);
}
}
}
return vars;
}
示例9: parseConnections
import org.dom4j.Element; //導入方法依賴的package包/類
protected List<Connection> parseConnections(Element element){
List<Connection> connections=new ArrayList<Connection>();
for(Object obj:element.elements()){
if(obj==null || !(obj instanceof Element)){
continue;
}
Element ele=(Element)obj;
if(!ele.getName().equals("connection")){
continue;
}
connections.add(buildConnection(ele));
}
return connections;
}
示例10: bindNamedAttributeNodes
import org.dom4j.Element; //導入方法依賴的package包/類
private static void bindNamedAttributeNodes(Element subElement, AnnotationDescriptor ann) {
List<Element> namedAttributeNodes = subElement.elements("named-attribute-node");
List<NamedAttributeNode> annNamedAttributeNodes = new ArrayList<NamedAttributeNode>( );
for(Element namedAttributeNode : namedAttributeNodes){
AnnotationDescriptor annNamedAttributeNode = new AnnotationDescriptor( NamedAttributeNode.class );
copyStringAttribute( annNamedAttributeNode, namedAttributeNode, "value", true );
copyStringAttribute( annNamedAttributeNode, namedAttributeNode, "subgraph", false );
copyStringAttribute( annNamedAttributeNode, namedAttributeNode, "key-subgraph", false );
annNamedAttributeNodes.add( (NamedAttributeNode) AnnotationFactory.create( annNamedAttributeNode ) );
}
ann.setValue( "attributeNodes", annNamedAttributeNodes.toArray( new NamedAttributeNode[annNamedAttributeNodes.size()] ) );
}
示例11: parse
import org.dom4j.Element; //導入方法依賴的package包/類
public SpringBean parse(Element element) {
SpringBean bean=new SpringBean();
bean.setId(element.attributeValue("id"));
for(Object obj:element.elements()){
if(obj==null || !(obj instanceof Element)){
continue;
}
Element ele=(Element)obj;
if(ele.getName().equals("method")){
Method method=parseMethod(ele);
bean.addMethod(method);
}
}
return bean;
}
示例12: initializeTimePatternData
import org.dom4j.Element; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private void initializeTimePatternData(Element rootElement) throws Exception {
loadExistingTimePatterns(session.getUniqueId());
Element timePatternsElement = rootElement.element(PointInTimeDataExport.sTimePatternsElementName);
for(Element timePatternElement : (List<Element>) timePatternsElement.elements()){
elementTimePattern(timePatternElement);
}
}
示例13: parse
import org.dom4j.Element; //導入方法依賴的package包/類
@Override
public Value parse(Element element) {
SlashValue value=new SlashValue();
List<Slash> slashes=new ArrayList<Slash>();
value.setSlashes(slashes);
for(Object obj:element.elements()){
if(obj==null || !(obj instanceof Element)){
continue;
}
Element ele=(Element)obj;
if(ele.getName().equals("slash")){
Slash slash=new Slash();
slashes.add(slash);
slash.setDegree(Integer.valueOf(ele.attributeValue("degree")));
slash.setX(Integer.valueOf(ele.attributeValue("x")));
slash.setY(Integer.valueOf(ele.attributeValue("y")));
slash.setText(ele.attributeValue("text"));
}else if(ele.getName().equals("base64-data")){
String prefix="data:image/png;base64,";
String base64Data=ele.getText();
if(base64Data.startsWith(prefix)){
base64Data=base64Data.substring(prefix.length(),base64Data.length());
}
value.setBase64Data(base64Data);
}
}
return value;
}
示例14: setUp
import org.dom4j.Element; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
InputStream is = new FileInputStream(new File(xmlFile));
if (is == null) {
throw new FileNotFoundException("Excel的描述文件 : " + xmlFile + " 未找到.");
}
SAXReader saxReader = new SAXReader();
Document document = saxReader.read(is);
// 根節點
Element root = document.getRootElement();
// 一次導入
onceList = root.elements("onceImport");
// 重複導入
List repeatList = root.elements("repeatImport");
// 校驗器的定義
List validators = root.elements("validators");
// 單元格校驗
List cellValidators = root.elements("cell-validators");
excelStruct = new ExcelStruct();
// 讀取校驗器配置
// parseValidatorConfig(excelStruct, validators, cellValidators);
// simpleParseOnceImport(excelStruct, onceList);
is.close();
}
示例15: orderSequenceElements
import org.dom4j.Element; //導入方法依賴的package包/類
/**
* Put sequence elements in the order specified by the sequence compositor.
*
* @param parent NOT YET DOCUMENTED
*/
public void orderSequenceElements(Element parent) {
String xpath = parent.getPath();
List order = schemaHelper.getChildrenOrder(xpath);
// just as a safeguard, don't reorder if there is only one child
// for the schemaNode, since parent is probably a repeating element
// and reordering would wipe out all but one child
if (order.size() < 2)
return;
// map element name to a list of elements to accomodate repeating elements
Map elementMap = new HashMap();
List elements = parent.elements();
for (int i = elements.size() - 1; i > -1; i--) {
Element e = (Element) elements.get(i);
String tagName = e.getName();
List items = (List) elementMap.get(tagName);
if (items == null)
items = new ArrayList();
items.add(0, e.detach()); // add to beginning to maintain doc ordering
elementMap.put(tagName, items);
}
for (Iterator i = order.iterator(); i.hasNext(); ) {
String name = (String) i.next();
elements = (List) elementMap.get(name);
if (elements != null) {
for (Iterator ii = elements.iterator(); ii.hasNext(); ) {
parent.add((Element) ii.next());
}
}
}
}