Search in sources :

Example 11 with Attribute

use of org.dom4j.Attribute in project pentaho-platform by pentaho.

the class BiPlatformRepositoryClientNavigationService method getName.

private String getName(Element element) {
    // $NON-NLS-1$
    String name = "";
    // $NON-NLS-1$
    Attribute attr = element.attribute("name");
    if (attr != null) {
        name = attr.getText();
    }
    return name;
}
Also used : Attribute(org.dom4j.Attribute) PropertyString(org.pentaho.commons.util.repository.type.PropertyString)

Example 12 with Attribute

use of org.dom4j.Attribute in project pentaho-platform by pentaho.

the class BiPlatformRepositoryClientNavigationService method getExtension.

private String getExtension(Element element) {
    // $NON-NLS-1$
    String name = "";
    // $NON-NLS-1$
    Attribute attr = element.attribute("name");
    if (attr != null) {
        name = attr.getText();
    }
    int idx = name.indexOf('.');
    // $NON-NLS-1$
    String extension = "";
    if (idx != -1) {
        extension = name.substring(idx + 1);
    }
    return extension;
}
Also used : Attribute(org.dom4j.Attribute) PropertyString(org.pentaho.commons.util.repository.type.PropertyString)

Example 13 with Attribute

use of org.dom4j.Attribute in project free-framework by a601942905git.

the class XmlUtil method getAttribute.

/**
 * @方法功能描述:  得到指定节点的指定属性
 * @方法名:getAttribute
 * @param element 指定的元素
 * @param attrName 属性名称
 * @return Attribute
 * @返回类型:Attribute
 * @时间:2011-4-14下午01:45:27
 */
public static Attribute getAttribute(Element element, String attrName) {
    attrName = attrName.trim();
    if (element == null)
        return null;
    if (attrName == null || attrName.equals(""))
        return null;
    Attribute attribute = element.attribute(attrName);
    return attribute;
}
Also used : Attribute(org.dom4j.Attribute)

Example 14 with Attribute

use of org.dom4j.Attribute in project free-framework by a601942905git.

the class XmlUtil method getNodeAttrMap.

/**
 * @方法功能描述:得到指定节点的所有属性及属性值
 * @方法名:getNodeAttrMap
 * @return 属性集合
 * @返回类型:Map<String,String>
 * @时间:2011-4-15上午10:00:26
 */
public static Map<String, String> getNodeAttrMap(Element e) {
    Map<String, String> attrMap = new HashMap<String, String>();
    if (e == null) {
        return null;
    }
    List<Attribute> attributes = getAttributeList(e);
    if (attributes == null) {
        return null;
    }
    for (Attribute attribute : attributes) {
        String attrValueString = attrValue(e, attribute.getName());
        attrMap.put(attribute.getName(), attrValueString);
    }
    return attrMap;
}
Also used : HashMap(java.util.HashMap) Attribute(org.dom4j.Attribute)

Example 15 with Attribute

use of org.dom4j.Attribute in project free-framework by a601942905git.

the class XmlUtil method getAttributeList.

/**
 * @方法功能描述:遍历指定节点的所有属性
 * @方法名:getAttributeList
 * @param e
 * @return 节点属性的list集合
 * @返回类型:List<Attribute>
 * @时间:2011-4-14下午01:41:38
 */
public static List<Attribute> getAttributeList(Element e) {
    if (e == null)
        return null;
    List<Attribute> attributeList = new ArrayList<Attribute>();
    Iterator<Attribute> atrIterator = getAttrIterator(e);
    if (atrIterator == null)
        return null;
    while (atrIterator.hasNext()) {
        Attribute attribute = atrIterator.next();
        attributeList.add(attribute);
    }
    return attributeList;
}
Also used : Attribute(org.dom4j.Attribute) ArrayList(java.util.ArrayList)

Aggregations

Attribute (org.dom4j.Attribute)114 Element (org.dom4j.Element)88 Document (org.dom4j.Document)30 ArrayList (java.util.ArrayList)28 List (java.util.List)26 Iterator (java.util.Iterator)23 Node (org.dom4j.Node)14 HashMap (java.util.HashMap)12 File (java.io.File)11 SAXReader (org.dom4j.io.SAXReader)11 IOException (java.io.IOException)10 Map (java.util.Map)6 VFSItem (org.olat.core.util.vfs.VFSItem)6 QTIObject (org.olat.ims.qti.editor.beecom.objects.QTIObject)6 Namespace (org.dom4j.Namespace)5 QName (org.dom4j.QName)5 PropertyString (org.pentaho.commons.util.repository.type.PropertyString)5 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)4 OutcomesProcessing (org.olat.ims.qti.editor.beecom.objects.OutcomesProcessing)4 AnnotatedElement (java.lang.reflect.AnnotatedElement)3