本文整理汇总了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());
}
}
}
}