Example usage for org.jdom2 Document getDescendants

List of usage examples for org.jdom2 Document getDescendants

Introduction

In this page you can find the example usage for org.jdom2 Document getDescendants.

Prototype

@Override
public <F extends Content> IteratorIterable<F> getDescendants(final Filter<F> filter) 

Source Link

Document

Returns an iterator that walks over all descendants in document order applying the Filter to return only elements that match the filter rule.

Usage

From source file:org.slc.sli.ingestion.parser.impl.XsdTypeProvider.java

License:Apache License

private void buildXsdElementsMap(Document doc, Map<String, String> map) {
    Iterable<Element> elements = doc.getDescendants(Filters.element(ELEMENT, XS_NAMESPACE));
    for (Element e : elements) {
        String type = getType(e);
        map.put(e.getAttributeValue(NAME), type);
    }/*  w  w w  . ja v a  2 s  .c  om*/
}

From source file:org.slc.sli.ingestion.parser.impl.XsdTypeProvider.java

License:Apache License

private void parseInterchangeSchemas(Resource schemaFile, SAXBuilder b) throws JDOMException, IOException {
    Document doc = b.build(schemaFile.getURL());

    // get interchange element name and build map for it
    Iterator<Element> schemaIter = doc.getDescendants(Filters.element(SCHEMA, XS_NAMESPACE)).iterator();

    buildMap(schemaIter, doc, ELEMENT);/*from   w w  w.j  a  v a  2 s.c o  m*/

    Iterator<Element> wrapperIter = doc.getDescendants(Filters.element(ELEMENT_ACTION, XS_NAMESPACE))
            .iterator();

    buildMap(wrapperIter, doc, ELEMENT_ACTION);

}