Package org.jdom.xpath

Examples of org.jdom.xpath.XPath.addNamespace()


    public List getTaglibs() throws JDOMException, IOException
    {
        SAXBuilder builder = new SAXBuilder();
        Document doc = builder.build(new File(getPluginScript()));
        XPath xpath = XPath.newInstance("/project/define:taglib");
        xpath.addNamespace( "define", "jelly:define" );
        List taglibElements = xpath.selectNodes(doc);
        List taglibs = new LinkedList();
        for (Iterator iter = taglibElements.iterator(); iter.hasNext();)
        {
            Element element = (Element) iter.next();
View Full Code Here


        try
        {
            Document doc = new SAXBuilder().build( req.getInputStream() );
                   
            XPath xpath = XPath.newInstance("/D:propfind/*");
            xpath.addNamespace( "D", "DAV:" );
       
            Element firstnode = (Element)xpath.selectSingleNode( doc );

            Element davresponse = null;

View Full Code Here

                davresponse = getPropertyNames( dc );
            }
            else if( firstnode.getName().equals("prop") )
            {
                XPath ndxp = XPath.newInstance("/D:propfind/D:prop/*");
                ndxp.addNamespace( "D", "DAV:" );
               
                List nodes = ndxp.selectNodes( doc );
                davresponse = getProperties( dc, nodes );
            }
View Full Code Here

        // Get all constraints that have our URL pattern
        // (Note the crazy j: prefix to denote the 2.4 j2ee schema)
        selector = "//j:web-app/j:security-constraint[j:web-resource-collection/j:url-pattern=\"" + url + "\"]";
        xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
        List<?> constraints = xpath.selectNodes( root );

        // Get all constraints that match our Role pattern
        selector = "//j:web-app/j:security-constraint[j:auth-constraint/j:role-name=\"" + role.getName() + "\"]";
        xpath = XPath.newInstance( selector );
View Full Code Here

        List<?> constraints = xpath.selectNodes( root );

        // Get all constraints that match our Role pattern
        selector = "//j:web-app/j:security-constraint[j:auth-constraint/j:role-name=\"" + role.getName() + "\"]";
        xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
        List<?> roles = xpath.selectNodes( root );

        // If we can't find either one, we must not be constrained
        if ( constraints.size() == 0 )
        {
View Full Code Here

        Element root = webxml.getRootElement();

        // Get roles referred to by constraints
        String selector = "//j:web-app/j:security-constraint/j:auth-constraint/j:role-name";
        XPath xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
        List<?> nodes = xpath.selectNodes( root );
        for( Iterator<?> it = nodes.iterator(); it.hasNext(); )
        {
            String role = ( (Element) it.next() ).getTextTrim();
            roles.add( new Role( role ) );
View Full Code Here

        }

        // Get all defined roles
        selector = "//j:web-app/j:security-role/j:role-name";
        xpath = XPath.newInstance( selector );
        xpath.addNamespace( "j", J2EE_SCHEMA_24_NAMESPACE );
        nodes = xpath.selectNodes( root );
        for( Iterator<?> it = nodes.iterator(); it.hasNext(); )
        {
            String role = ( (Element) it.next() ).getTextTrim();
            roles.add( new Role( role ) );
View Full Code Here

        try
        {
            Document doc = new SAXBuilder().build( req.getInputStream() );
                   
            XPath xpath = XPath.newInstance("/D:propfind/*");
            xpath.addNamespace( "D", "DAV:" );
       
            Element firstnode = (Element)xpath.selectSingleNode( doc );

            Element davresponse = null;

View Full Code Here

                davresponse = getPropertyNames( dc );
            }
            else if( firstnode.getName().equals("prop") )
            {
                XPath ndxp = XPath.newInstance("/D:propfind/D:prop/*");
                ndxp.addNamespace( "D", "DAV:" );
               
                List nodes = ndxp.selectNodes( doc );
                davresponse = getProperties( dc, nodes );
            }
View Full Code Here

        Element root = document.getRootElement();
        if(root != null)
        {
            if(StringUtils.isNotEmpty(root.getNamespaceURI()))
            {
                xpath.addNamespace(NAMESPACE_PREFIX, root.getNamespaceURI());
            }
        }
        return xpath;
    }
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.