Search in sources :

Example 6 with SimpleNamespaceContext

use of org.jaxen.SimpleNamespaceContext in project pentaho-platform by pentaho.

the class PentahoObjectsConfig method getObjectBeanElement.

protected Element getObjectBeanElement(String objectId) {
    try {
        String xPath = MessageFormat.format(BEAN_ID_XPATH, objectId);
        HashMap<String, String> map = new HashMap<String, String>();
        // $NON-NLS-1$
        map.put("default", DEFAULT_NAMESPACE);
        Dom4jXPath xpath = new Dom4jXPath(xPath);
        xpath.setNamespaceContext(new SimpleNamespaceContext(map));
        Element element = (Element) xpath.selectSingleNode(document);
        return element;
    } catch (JaxenException jex) {
        return null;
    }
}
Also used : Dom4jXPath(org.jaxen.dom4j.Dom4jXPath) HashMap(java.util.HashMap) Element(org.dom4j.Element) JaxenException(org.jaxen.JaxenException) SimpleNamespaceContext(org.jaxen.SimpleNamespaceContext)

Example 7 with SimpleNamespaceContext

use of org.jaxen.SimpleNamespaceContext in project pentaho-platform by pentaho.

the class PentahoObjectsConfig method getObjectClassName.

public String getObjectClassName(String objectId) {
    try {
        String xPath = MessageFormat.format(BEAN_ID_XPATH, objectId);
        HashMap<String, String> map = new HashMap<String, String>();
        // $NON-NLS-1$
        map.put("default", DEFAULT_NAMESPACE);
        Dom4jXPath xpath = new Dom4jXPath(xPath);
        xpath.setNamespaceContext(new SimpleNamespaceContext(map));
        Element element = (Element) xpath.selectSingleNode(document);
        return element.attributeValue(CLASS_ATTRIBUTE);
    } catch (JaxenException jex) {
        return null;
    }
}
Also used : Dom4jXPath(org.jaxen.dom4j.Dom4jXPath) HashMap(java.util.HashMap) Element(org.dom4j.Element) JaxenException(org.jaxen.JaxenException) SimpleNamespaceContext(org.jaxen.SimpleNamespaceContext)

Aggregations

SimpleNamespaceContext (org.jaxen.SimpleNamespaceContext)7 JaxenException (org.jaxen.JaxenException)5 HashMap (java.util.HashMap)4 Element (org.dom4j.Element)4 Dom4jXPath (org.jaxen.dom4j.Dom4jXPath)4 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 Builder (nu.xom.Builder)1 ParsingException (nu.xom.ParsingException)1 AXIOMXPath (org.apache.axiom.om.xpath.AXIOMXPath)1 Attribute (org.dom4j.Attribute)1 Namespace (org.dom4j.Namespace)1 Node (org.dom4j.Node)1 QName (org.dom4j.QName)1 XPath (org.jaxen.XPath)1 DOMXPath (org.jaxen.dom.DOMXPath)1 XOMXPath (org.jaxen.xom.XOMXPath)1 Element (org.jdom.Element)1 SAXBuilder (org.jdom.input.SAXBuilder)1