Package org.jdom.filter

Examples of org.jdom.filter.ElementFilter


               element,
               "countKey");

        // Check against "other"
        element = (ODOMElement)element.getParent().getContent(
            new ElementFilter()).get(1);

        // Check the XPath cache
        doTest(constraint,
               element,
               null);
View Full Code Here


            }

            // Get the element children, filtering also on namespace.
            List typeContent =
                    typeElement.getContent(
                            new ElementFilter(typeElement.getNamespace()));

            // element should be e.g. <boolean />
            Element emptyPolicyType = (Element) typeContent.get(0);

            if (emptyPolicyType == null) {
View Full Code Here

        }
    }

    private void outAndBack(ElementFilter filter) {
        ByteArrayOutputStream bytes = serialize(filter);
        ElementFilter filter2 = (ElementFilter) deserialize(bytes);
        assertTrue(filter.equals(filter2));
    }
View Full Code Here

        ElementFilter filter2 = (ElementFilter) deserialize(bytes);
        assertTrue(filter.equals(filter2));
    }

    public void test_ElementFilterName() {
        outAndBack(new ElementFilter("name"));
    }
View Full Code Here

    public void test_ElementFilterName() {
        outAndBack(new ElementFilter("name"));
    }

    public void test_ElementFilterNameNamespace() {
        outAndBack(new ElementFilter("name", Namespace.XML_NAMESPACE));
    }
View Full Code Here

    public void test_ElementFilterNameNamespace() {
        outAndBack(new ElementFilter("name", Namespace.XML_NAMESPACE));
    }

    public void test_ElementFilterNamespace() {
        outAndBack(new ElementFilter(Namespace.XML_NAMESPACE));
    }
View Full Code Here

    public void test_ElementFilterNamespace() {
        outAndBack(new ElementFilter(Namespace.XML_NAMESPACE));
    }

    public void test_ElementFilterEmpty() {
        outAndBack(new ElementFilter());
    }
View Full Code Here

    }   
   

    public static  List<Element> getElements(Element root, String name) {
        List<Element> list = new ArrayList<Element>();
        Iterator it = root.getDescendants(new ElementFilter(name));
        while(it.hasNext()) {
            Object o = it.next();
            if( o instanceof Element) {
                list.add((Element)o);
            }
View Full Code Here

                rootElement.setAttribute( "schemaLocation", "http://maven.apache.org/POM/" + modelVersion
                    + " http://maven.apache.org/maven-v" + modelVersion.replace( '.', '_' ) + ".xsd", xsiNamespace );
            }

            // the empty namespace is considered equal to the POM namespace, so match them up to avoid extra xmlns=""
            ElementFilter elementFilter = new ElementFilter( Namespace.getNamespace( "" ) );
            for ( Iterator i = rootElement.getDescendants( elementFilter ); i.hasNext(); )
            {
                Element e = (Element) i.next();
                e.setNamespace( pomNamespace );
            }
View Full Code Here

    @Test
    public void testRestructureReport() throws Exception {
        final Element report = Xml.loadString(REPORT, false);
        Validate.restructureReportToHavePatternRuleHierarchy(report);

        final Iterator patternsIter = report.getDescendants(new ElementFilter(Validate.EL_ACTIVE_PATTERN, Geonet.Namespaces.SVRL));
        while (patternsIter.hasNext()) {
            Object next = patternsIter.next();

            assertPattern((Element) next);
        }
View Full Code Here

TOP

Related Classes of org.jdom.filter.ElementFilter

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.