Example usage for org.jdom2 Element getChild

List of usage examples for org.jdom2 Element getChild

Introduction

In this page you can find the example usage for org.jdom2 Element getChild.

Prototype

public Element getChild(final String cname) 

Source Link

Document

This returns the first child element within this element with the given local name and belonging to no namespace.

Usage

From source file:com.ohnosequences.xml.model.genome.feature.Feature.java

License:Open Source License

public PalindromicityResultXML getOddAxisPalindromicityResult() throws XMLElementException {
    Element elem = root.getChild(ODD_AXIS_PALINDROMICITY_TAG_NAME);
    if (elem == null) {
        return null;
    } else {/*from   w  w w.ja  v  a  2s. c  o m*/
        Element palResult = elem.getChild(PalindromicityResultXML.TAG_NAME);
        if (palResult == null) {
            return null;
        } else {
            return new PalindromicityResultXML(palResult);
        }
    }
}

From source file:com.ohnosequences.xml.model.genome.feature.Feature.java

License:Open Source License

public PalindromicityResultXML getEvenAxisPalindromicityResult() throws XMLElementException {
    Element elem = root.getChild(EVEN_AXIS_PALINDROMICITY_TAG_NAME);
    if (elem == null) {
        return null;
    } else {//w w  w.  ja v a  2s. c  om
        Element palResult = elem.getChild(PalindromicityResultXML.TAG_NAME);
        if (palResult == null) {
            return null;
        } else {
            return new PalindromicityResultXML(palResult);
        }
    }
}

From source file:com.ohnosequences.xml.model.genome.feature.Feature.java

License:Open Source License

public PalindromicityResultXML getMaxWordLengthEvenAxisPalindromicityResult() throws XMLElementException {
    Element elem = root.getChild(MAX_WORD_LENGTH_EVEN_AXIS_PALINDROMICITY_TAG_NAME);
    if (elem == null) {
        return null;
    } else {//from  ww  w .j a  v a  2 s. c  o  m
        Element palResult = elem.getChild(PalindromicityResultXML.TAG_NAME);
        if (palResult == null) {
            return null;
        } else {
            return new PalindromicityResultXML(palResult);
        }
    }
}

From source file:com.ohnosequences.xml.model.genome.feature.Feature.java

License:Open Source License

public PalindromicityResultXML getMaxWordLengthOddAxisPalindromicityResult() throws XMLElementException {
    Element elem = root.getChild(MAX_WORD_LENGTH_ODD_AXIS_PALINDROMICITY_TAG_NAME);
    if (elem == null) {
        return null;
    } else {//from  www .  j  a  v  a2  s .com
        Element palResult = elem.getChild(PalindromicityResultXML.TAG_NAME);
        if (palResult == null) {
            return null;
        } else {
            return new PalindromicityResultXML(palResult);
        }
    }
}

From source file:com.ohnosequences.xml.model.go.GoTermXML.java

License:Open Source License

public static GoTermXML getGoTerm(String id) throws Exception {

    GoTermXML temp = new GoTermXML();

    URL url = new URL(GO_TERM_SERVICE_URL + id);
    // Connect/*from w  w  w .  j  a v a2 s  .c  o m*/
    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
    // Get data
    SAXBuilder saxBuilder = new SAXBuilder();
    Document doc = saxBuilder.build(urlConnection.getInputStream());

    Element termElement = doc.getRootElement().getChild("term");

    String idString, nameString, defString;
    idString = termElement.getChildText("id");
    nameString = termElement.getChildText("name");
    defString = termElement.getChild("def").getChildText("defstr");

    if (!id.equals(idString)) {
        throw new Exception(
                "El id proporcionado y el encontrado en el xml proporcionado por el servicio no son el mismo");
    } else {
        temp.setId(idString);
        temp.setGoName(nameString);
        temp.setDefinition(defString);
    }

    return temp;
}

From source file:com.ohnosequences.xml.model.go.GoTermXML.java

License:Open Source License

public GoTermXML getProteinAnnotationLeadingToSlimTerm() {
    GoTermXML result = null;//from www.j a  va  2s.  c  o  m
    Element elem = root.getChild(PROTEIN_ANNOTATION_LEADING_TO_SLIM_TERM);
    if (elem != null) {
        Element goElem = elem.getChild(GoTermXML.TAG_NAME);
        result = new GoTermXML(goElem);
    }
    return result;
}

From source file:com.ohnosequences.xml.model.HspSet.java

License:Open Source License

public HspSet(Element elem) throws XMLElementException {
    array = new ArrayList<Hsp>();
    hit = new Hit(elem.getChild(Hit.TAG_NAME));
    List<Element> list = elem.getChild(HSPS_TAG_NAME).getChildren(Hsp.TAG_NAME);
    for (Element temp : list) {
        array.add(new Hsp(temp));
    }/*w w w. j a va  2 s  .  co  m*/
}

From source file:com.ohnosequences.xml.model.PredictedGene.java

License:Open Source License

public Codon getInitCodon() throws XMLElementException {
    Codon temp = null;//from  ww  w  . ja v a  2s  .  c om
    Element elem = root.getChild(START_CODON_TAG_NAME);
    if (elem != null) {
        Element elem2 = elem.getChild(Codon.TAG_NAME);
        if (elem2 != null) {
            temp = new Codon(elem2);
        }
    }
    return temp;
}

From source file:com.ohnosequences.xml.model.PredictedGene.java

License:Open Source License

public Codon getStopCodon() throws XMLElementException {
    Codon temp = null;//from  www . j av  a  2 s  .  c om
    Element elem = root.getChild(STOP_CODON_TAG_NAME);
    if (elem != null) {
        Element elem2 = elem.getChild(Codon.TAG_NAME);
        if (elem2 != null) {
            temp = new Codon(elem2);
        }
    }
    return temp;
}

From source file:com.ohnosequences.xml.model.uniprot.ProteinXML.java

License:Open Source License

public List<GoTermXML> getMolecularFunctionGoTerms() {
    Element goTerms = root.getChild(GO_TERMS_TAG_NAME);
    if (goTerms != null) {
        Element molFunc = goTerms.getChild(FUNCTION_GO_TERMS_TAG_NAME);
        if (molFunc != null) {
            List<Element> gos = molFunc.getChildren(GoTermXML.TAG_NAME);
            ArrayList<GoTermXML> result = new ArrayList<GoTermXML>();
            for (Element elem : gos) {
                result.add(new GoTermXML(elem));
            }/*from  w  w  w  .ja  v a  2 s. c  o m*/
            return result;
        } else {
            return null;
        }
    } else {
        return null;
    }
}