Package org.jaxen

Examples of org.jaxen.SimpleNamespaceContext


        else if( document instanceof Document )
            xpath = new DOMXPath(xpathExpr);
        else
            fail("Document type "+document.getClass().getName());

        xpath.setNamespaceContext(new SimpleNamespaceContext(namespaces));

        return xpath.stringValueOf(document);
    }
View Full Code Here


            if (log.isDebugEnabled()) {
                log.debug( "Setting the namespace context to be: " + uris );
            }

            xpath.setNamespaceContext( new SimpleNamespaceContext( this.uris ) );

            return xpath;
        }
        catch (JaxenException e)
        {
View Full Code Here

    public String toString() {
        return "[XPathPattern: text: " + text + " Pattern: " + pattern + "]";
    }

    protected ContextSupport getContextSupport() {
        return new ContextSupport(new SimpleNamespaceContext(),
                XPathFunctionContext.getInstance(),
                new SimpleVariableContext(), DocumentNavigator.getInstance());
    }
View Full Code Here

    public NamespaceContext getNamespaceContext() {
        return namespaceContext;
    }

    public void setNamespaceURIs(Map map) {
        setNamespaceContext(new SimpleNamespaceContext(map));
    }
View Full Code Here

                HashMap<String, String> map = new HashMap<String, String>();
                map.put("pmh", "http://www.openarchives.org/OAI/2.0/");
                map.put("xb", "http://com/exlibris/digitool/repository/api/xmlbeans");

                XPath xpathTitle = new Dom4jXPath("/pmh:OAI-PMH/pmh:GetRecord/pmh:record/pmh:metadata/xb:digital_entity/pmh:mds/pmh:md[pmh:type='dc' and pmh:name='descriptive']/pmh:value");
                xpathTitle.setNamespaceContext(new SimpleNamespaceContext(map));

                XPath xpathURL = new Dom4jXPath("/pmh:OAI-PMH/pmh:GetRecord/pmh:record/pmh:metadata/xb:digital_entity/pmh:urls/pmh:url[@type='stream']");
                xpathURL.setNamespaceContext(new SimpleNamespaceContext(map));

                XPath xpathLabel = new Dom4jXPath("/pmh:OAI-PMH/pmh:GetRecord/pmh:record/pmh:metadata/xb:digital_entity/pmh:control/pmh:label");
                xpathLabel.setNamespaceContext(new SimpleNamespaceContext(map));


                Node dcNode = (Node) xpathTitle.selectSingleNode(doc);
                Node urlNode = (Node) xpathURL.selectSingleNode(doc);
                // Node labelNode = (Node) xpathLabel.selectSingleNode(doc);
View Full Code Here

                map.put("pmh", "http://www.openarchives.org/OAI/2.0/")
                map.put("xb", "http://com/exlibris/digitool/repository/api/xmlbeans");
               
                try {
                  XPath xpathURL = new Dom4jXPath("/pmh:OAI-PMH/pmh:ListRecords/pmh:record/pmh:metadata/xb:digital_entity/pmh:urls/pmh:url[@type='stream']");
                  xpathURL.setNamespaceContext(new SimpleNamespaceContext(map));
           
            List urlList = xpathURL.selectNodes(list.getResponse());
            for (Object aNode : urlList) {
              try {
                if (aNode instanceof Node) {
View Full Code Here

   
    public void testJAXEN50() throws JaxenException {
       
        DOMXPath xpath = new DOMXPath("true()");
       
        SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
        // Add all namespace declarations from the node
        nsContext.addElementNamespaces(xpath.getNavigator(), doc);
        xpath.setNamespaceContext(nsContext);
       
        boolean result = xpath.booleanValueOf(doc);
        assertTrue(result);
       
View Full Code Here

     * namespace context does not affect the context. i.e.
     * data encapsulation is not violated.
     */
    public void testMapCopy() {
        Map map = new HashMap();
        SimpleNamespaceContext context = new SimpleNamespaceContext(map);
        map.put("pre", "http://www.example.org/");
        assertNull(context.translateNamespacePrefixToUri("pre"));
    }
View Full Code Here

    public void testCantUseNonStringsAsValues() {
        Map map = new HashMap();
        map.put("key", new Object());
        try {
            new SimpleNamespaceContext(map);
            fail("added non String value to namespace context");
        }
        catch (Exception ex) {
            assertNotNull(ex.getMessage());
        }
View Full Code Here

    public void testCantUseNonStringsAsKeys() {
        Map map = new HashMap();
        map.put(new Object(), "value");
        try {
            new SimpleNamespaceContext(map);
            fail("added non String key to namespace context");
        }
        catch (Exception ex) {
            assertNotNull(ex.getMessage());
        }
View Full Code Here

TOP

Related Classes of org.jaxen.SimpleNamespaceContext

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.