Search in sources :

Example 1 with ContentFilter

use of org.jdom.filter.ContentFilter in project vcell by virtualcell.

the class CellQuanVCTranslator method fixMathMLBug.

// temporary method.
private void fixMathMLBug(Element math) {
    ArrayList<Element> l = new ArrayList<Element>();
    @SuppressWarnings("unchecked") Iterator<Element> walker = new JDOMTreeWalker(math, new ContentFilter(ContentFilter.ELEMENT));
    while (walker.hasNext()) l.add(walker.next());
    Element temp;
    for (int i = 0; i < l.size(); i++) {
        temp = l.get(i);
        if (temp.getName().equals(MathMLTags.CONSTANT)) {
            @SuppressWarnings("unchecked") ArrayList<Attribute> atts = new ArrayList<Attribute>(temp.getAttributes());
            org.jdom.Attribute att;
            for (int j = 0; j < atts.size(); j++) {
                att = atts.get(j);
                temp.removeAttribute(att.getName(), mathns);
            }
            temp.removeNamespaceDeclaration(mathns);
        }
    }
}
Also used : Attribute(org.jdom.Attribute) Element(org.jdom.Element) ArrayList(java.util.ArrayList) Attribute(org.jdom.Attribute) ContentFilter(org.jdom.filter.ContentFilter) JDOMTreeWalker(cbit.util.xml.JDOMTreeWalker)

Aggregations

JDOMTreeWalker (cbit.util.xml.JDOMTreeWalker)1 ArrayList (java.util.ArrayList)1 Attribute (org.jdom.Attribute)1 Element (org.jdom.Element)1 ContentFilter (org.jdom.filter.ContentFilter)1