Package org.jdom.xpath

Examples of org.jdom.xpath.XPath


    protected Instruction createInstruction(Configuration instruction) throws ConfigurationException {
        try {
            String property = instruction.getAttribute("property");
            String namespace = instruction.getAttribute("namespace", "DAV:");
            XPath xPath = XPath.newInstance(instruction.getAttribute("xpath"));
            return new Instruction(xPath, new PropertyName(property, namespace));
        } catch (JDOMException e) {
            throw new ConfigurationException("Could not create xPath from given attribute", instruction);
        }
    }
View Full Code Here


          DocumentValue documentValue = new DocumentValue((StreamableValue)content);
          Map instructionMap = ((MapValue)instructions).getMap();
          for ( Iterator j = instructionMap.entrySet().iterator(); j.hasNext(); ) {
            Map.Entry entry = (Map.Entry)j.next();
            String key = (String) entry.getKey();
            XPath xPath = XPath.newInstance(entry.getValue().toString());
            List nodeList = xPath.selectNodes(documentValue.getRootElement());
            resultMap.put(key, XPathQuery.createValueFromNodeList(nodeList));
          }
        }
        if ( includeContent ) {
          resultMap.put(CONTENT_ENTRY, content);
View Full Code Here

public class XPathQuery extends SimpleProcessor implements ConfigurableProcessor {
    private Element rootElement;

    public Value process(Value input, Context context) throws Exception {
        XPath xPath = XPath.newInstance(((StringValue)input).toString());
        List nodeList = xPath.selectNodes(rootElement);
        return createValueFromNodeList(nodeList);
    }
View Full Code Here

    {
        StringBuffer sb = new StringBuffer();
       
        try
        {
            XPath xp = XPath.newInstance( ALL_TEXT_NODES );
       
            List nodes = xp.selectNodes(m_document.getDocument());
           
            for( Iterator i = nodes.iterator(); i.hasNext(); )
            {
                Object el = i.next();
               
View Full Code Here

        throws JDOMException,
               IOException
    {
        Document doc = new SAXBuilder().build( xmlStream );
       
        XPath xpath = XPath.newInstance("/pagefilters/filter");
   
        List nodes = xpath.selectNodes( doc );
       
        for( Iterator i = nodes.iterator(); i.hasNext(); )
        {
            Element f = (Element) i.next();
           
View Full Code Here

        OMElement response = stub.getStockQuote(child);

        StAXBuilder builder = new StAXBuilder();
        Document doc = builder.build(response.getXMLStreamReader());
        XPath path = XPath.newInstance("//price");
        Element price = (Element) path.selectSingleNode(doc.getRootElement());
        System.out.println("Price = " + price.getText());
    }
View Full Code Here

        OMElement response = stub.getStockQuote(child);

        StAXBuilder builder = new StAXBuilder();
        Document doc = builder.build(response.getXMLStreamReader());
        XPath path = XPath.newInstance("//price");
        Element price = (Element) path.selectSingleNode(doc.getRootElement());
        System.out.println("Price = " + price.getText());
    }
View Full Code Here

        return bestCandidate;
    }

    private Element getMatch(Object doc, String xpath) {
        try {
            XPath path = XPath.newInstance(xpath);
            return (Element)path.selectSingleNode(doc);
        } catch (JDOMException e) {
            throw new DatabindingException("Error evaluating xpath " + xpath, e);
        }
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    private List<Element> getMatches(Object doc, String xpath) {
        try {
            XPath path = XPath.newInstance(xpath);
            return path.selectNodes(doc);
        } catch (JDOMException e) {
            throw new DatabindingException("Error evaluating xpath " + xpath, e);
        }
    }
View Full Code Here

        throws JDOMException,
               IOException
    {
        Document doc = new SAXBuilder().build( xmlStream );
       
        XPath xpath = XPath.newInstance("/pagefilters/filter");
   
        List nodes = xpath.selectNodes( doc );
       
        for( Iterator i = nodes.iterator(); i.hasNext(); )
        {
            Element f = (Element) i.next();
           
View Full Code Here

TOP

Related Classes of org.jdom.xpath.XPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.